自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

DIV+CSS圓角效果輕松實(shí)現(xiàn)

開發(fā) 前端
做網(wǎng)站設(shè)計(jì)的時(shí)候,免不了和DIV+CSS打交道,而DIV+CSS圓角則是網(wǎng)站設(shè)計(jì)必經(jīng)的一課,比較了網(wǎng)絡(luò)上眾多的DIV+CSS圓角實(shí)現(xiàn)的方案都不容樂觀,這里向大家描述一種簡潔實(shí)用的方法,

本節(jié)向大家介紹一下DIV+CSS圓角的簡單實(shí)現(xiàn)方法,即使用圖片做背景的DIV+CSS圓角實(shí)現(xiàn)方案。一張圖片利用CSS定位,實(shí)現(xiàn)DIV的四個(gè)邊角都是圓角。這樣的好處是,只需要一張圓形的圖片,就可以實(shí)現(xiàn)四個(gè)圓角了。

DIV+CSS圓角的簡單實(shí)現(xiàn)方法

做網(wǎng)站設(shè)計(jì)的時(shí)候,免不了和DIV+CSS打交道,而DIV+CSS圓角則是網(wǎng)站設(shè)計(jì)必經(jīng)的一課。比較了網(wǎng)絡(luò)上眾多的DIV+CSS圓角實(shí)現(xiàn)的方案,包括不用圖片純CSS實(shí)現(xiàn)圓角的許多方案,結(jié)果是不用圖片的DIV+CSS圓角無一例外,都使用了大量的冗余無意義的css代碼,而且在IE、Firefox、chrome等多瀏覽器下的兼容性不容樂觀。

總結(jié)一下,建議大家還是使用圖片做背景的DIV+CSS圓角實(shí)現(xiàn)方案。一張圖片利用CSS定位,實(shí)現(xiàn)DIV的四個(gè)邊角都是圓角。這樣的好處是,只需要一張圓形的圖片,就可以實(shí)現(xiàn)四個(gè)圓角了。

HTML代碼: 

  1. <divclassdivclass="nav"> 
  2. <divclassdivclass="nav2"> 
  3. <SPANclassSPANclass=leftTop></SPAN> 
  4. <SPANclassSPANclass=rightTop></SPAN> 
  5.  

這里是主體內(nèi)容....

  1. <SPANclassSPANclass=leftBottom></SPAN> 
  2. <SPANclassSPANclass=rightBottom></SPAN> 
  3. </div> 
  4. </div> 

CSS代碼: 

  1. .nav{  
  2. position:relative;  
  3. width:500px;  
  4. margin:0pxauto;  
  5. background:#eeeeee;  
  6. }  
  7. .nav2{  
  8. border:1pxsolid#dddddd;  
  9. padding:4px0px2px0px;  
  10. height:42px;  
  11. text-align:center;  
  12. }  
  13.  
  14. /*DIV+CSS圓角處理*/  
  15. .nav.leftTop{/*DIV+CSS圓角左上角*/  
  16. background:url(images/wbb.gif)no-repeatlefttop;  
  17. width:10px;  
  18. height:10px;  
  19. position:absolute;  
  20. left:0;  
  21. top:0;  
  22. }  
  23. .nav.rightTop{/*DIV+CSS圓角右上角*/  
  24. background:url(images/wbb.gif)no-repeatrighttop;  
  25. width:10px;  
  26. height:10px;  
  27. position:absolute;  
  28. right:0;  
  29. top:0;  
  30. }  
  31. .nav.leftBottom{/*DIV+CSS圓角左下角*/  
  32. background:url(images/wbb.gif)no-repeatleftbottom;  
  33. width:10px;  
  34. height:10px;  
  35. position:absolute;  
  36. left:0;  
  37. bottom:0;  
  38. }  
  39. .nav.rightBottom{/*DIV+CSS圓角右下角*/  
  40. background:url(images/wbb.gif)no-repeatrightbottom;  
  41. width:10px;  
  42. height:10px;  
  43. position:absolute;  
  44. right:0;  
  45. bottom:0;  
  46. }  
  47. /*DIV+CSS圓角處理end*/  

【編輯推薦】

  1. DIV CSS網(wǎng)頁布局時(shí)合理架構(gòu)CSS
  2. 技術(shù)分享 如何實(shí)現(xiàn)CSS橫向?qū)Ш?/a>
  3. 技術(shù)分享 DIV CSS網(wǎng)站布局八大竅門
  4. DIV CSS中id與class使用用原則與技巧
  5. 鼠標(biāo)經(jīng)過時(shí)改變DIV背景顏色的三種途徑

 

責(zé)任編輯:佚名 來源: piaoyi.org
相關(guān)推薦

2010-08-26 15:59:38

DIV圓角

2010-08-25 09:11:57

DIVCSS

2011-05-17 09:51:27

Div+CSS

2010-08-24 11:25:06

DIVCSS

2012-08-06 09:40:36

DIV

2010-09-14 11:19:23

DIV+CSS技術(shù)

2010-08-25 12:47:40

DIVCSS

2010-08-24 10:32:34

DIV+CSS

2010-08-27 14:05:40

DIV+CSS

2010-08-16 15:19:35

DIV+CSS教程

2010-08-30 10:46:13

DIV+CSS

2010-08-30 13:09:40

DIVCSS

2010-09-07 09:30:25

DIV彈出jQuery

2010-09-14 10:41:24

DIV+CSS排版

2010-08-23 14:30:14

DIV+CSS

2010-08-16 16:17:21

2010-09-03 13:51:59

DIVCSS

2011-07-05 16:26:48

DIV+CSS

2011-05-26 18:05:01

DIV+CSS

2010-09-09 10:07:05

DIVCSS
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號