最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

非常漂亮的css星級效果總結(jié)

 更新時間:2007年12月05日 21:06:06   投稿:mdxy-dxy  
這篇文章結(jié)合實例形式歸納總結(jié)了css實現(xiàn)星級效果的設(shè)置技巧與注意事項,代碼簡潔實用,需要的朋友可以參考一下

也許上面這段文字你看得有些生澀,沒有關(guān)系,讓我們結(jié)合css代碼來看看解決辦法

復(fù)制代碼 代碼如下:

<ul class="star-rating"> 
<li class="current-rating">Currently 3.5/5 Stars.</li> 
<li><a href="#" title="1 star out of 5" class="one-star">1</a></li> 
<li><a href="#" title="2 stars out of 5" class="two-stars">2</a></li> 
<li><a href="#" title="3 stars out of 5" class="three-stars">3</a></li> 
<li><a href="#" title="4 stars out of 5" class="four-stars">4</a></li> 
<li><a href="#" title="5 stars out of 5" class="five-stars">5</a></li> 
</ul> 

<style> 
.star-rating{/*這里是空分層,用來顯示空星星*/ 
list-style:none; 
margin: 0px; 
padding:0px; 
width: 150px; 
height: 30px; 
position: relative; 
background: url(star_rating2.gif) top left repeat-x;/*空星星位于背景圖片的頂層,將其設(shè)為背景并橫向平鋪*/  

.star-rating li{/*設(shè)置li的浮動屬性*/ 
padding:0px; 
margin:0px; 
/*\*/ 
float: left; 
/* */ 

.star-rating li a{/*設(shè)置a的布局為絕對布局和垂直坐標(biāo)并隱藏a中文本使其成為空鏈接*/ 
display:block; 
width:30px; 
height: 30px; 
text-decoration: none; 
text-indent: -9000px; 
z-index: 20; 
position: absolute; 
padding: 0px; 

.star-rating li a:hover{/*設(shè)置a:hover的背景圖片為打分星/垂直坐標(biāo)/left為0,注意垂直坐標(biāo)一定要小于a的垂直坐標(biāo)*/ 
background: url(star_rating2.gif) left center; 
z-index: 2; 
left: 0px; 


/*以下5個class用來設(shè)置5個鏈接的位置和hover的寬度*/ 
.star-rating a.one-star{ 
left: 0px; 

.star-rating a.one-star:hover{ 
width:30px; 

.star-rating a.two-stars{ 
left:30px; 

.star-rating a.two-stars:hover{ 
width: 60px; 

.star-rating a.three-stars{ 
left: 60px; 

.star-rating a.three-stars:hover{ 
width: 90px; 

.star-rating a.four-stars{ 
left: 90px; 
}  
.star-rating a.four-stars:hover{ 
width: 120px; 

.star-rating a.five-stars{ 
left: 120px; 

.star-rating a.five-stars:hover{ 
width: 150px; 


.star-rating li.current-rating{/*設(shè)置分?jǐn)?shù)層的背景和寬度并隱藏文本*/ 
background: url(star_rating2.gif) left bottom; 
position: absolute; 
height: 30px; 
width:105px; 
display: block; 
text-indent: -9000px; 
z-index: 1; 
}  
</style> 
看完這些,我相信你應(yīng)該明白了其中的原理了吧,如果還是不明白可以給我留言,或許還是我的文章寫得不夠好:)

[Ctrl+A 全選 注:引入外部Js需再刷新一下頁面才能執(zhí)行]

相關(guān)文章

最新評論

安乡县| 彭泽县| 乌审旗| 江陵县| 萍乡市| 通州区| 门头沟区| 榕江县| 太仓市| 新蔡县| 吉木乃县| 日照市| 乌什县| 香港| 石屏县| 岗巴县| 沙湾县| 遵义县| 华宁县| 门头沟区| 东安县| 南丰县| 焉耆| 商丘市| 延庆县| 宁晋县| 金门县| 淳化县| 竹溪县| 师宗县| 佳木斯市| 肇源县| 望城县| 东阿县| 呼伦贝尔市| 新郑市| 普兰县| 康保县| 江都市| 茶陵县| 山阴县|