一波CSS制作的三角形和圆形小按钮示例

参考了天猫、微博等网站的做法,用纯html和css实现,效果还是不错的。
以下是成果,兼容主流浏览器,包括ie6。

CSS Code
复制内容到剪贴板

  1. <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”             “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>   
  2. <html xmlns=“http://www.w3.org/1999/xhtml”>   
  3.   
  4. <head>   
  5. <meta http-equiv=“Content-Type” content=“text/html; charset=utf-8” />   
  6. <meta http-equiv=“Content-Language” content=“zh-CN” />   
  7. <meta name=“Keywords” content=“” />   
  8. <meta name=“Description” content=“” />   
  9. <title></title>   
  10. </head>   
  11. <style type=“text/css”>   
  12. *{margin:0; padding:0; list-style:nonefont:normal 12px/150% 宋体; }   
  13. body{ padding:20px; }   
  14. .arrow{ margin-bottom:20px;  }   
  15.   
  16. /* css三角形 */  
  17. .arrow,.arrow s { position:relative;  display:blockfont-size: 0; line-            height: 0; width: 0; height: 0; border-color:transparentborder-style:dashedborder-width:5px; }   
  18. .arrowR,.arrowR s{ border-leftcolor:#aaaborder-left-style:solid; }   
  19. .arrowR s{ border-leftcolor:#fffposition:absoluteleft:-7pxtop:-5px; }   
  20. .arrowR:hover{ border-leftcolor:#f60;  }   
  21.   
  22. .arrowL,.arrowL s{ border-rightcolor:#aaaborder-right-style:solid; }   
  23. .arrowL s{ border-rightcolor:#fffposition:absoluterightright:-7pxtop:-5px; }   
  24. .arrowL:hover{ border-rightcolor:#f60;  }   
  25.   
  26. .arrowT,.arrowT s{ border-bottomcolor:#aaaborder-bottom-style:solid; }   
  27. .arrowT s{ border-bottomcolor:#fffposition:absoluteleft:-5pxtop:-3px; }   
  28. .arrowT:hover{ border-bottomcolor:#f60;  }   
  29.   
  30. .arrowB,.arrowB s{ border-topcolor:#aaaborder-top-style:solid; }   
  31. .arrowB s{ border-topcolor:#fffposition:absoluteleft:-5pxbottombottom:-3px; }   
  32. .arrowB:hover{ border-topcolor:#f60;  }   
  33.   
  34. /* css圆形 */  
  35. .circleline-height:100%; overflow:hidden;  font–    family:Tahoma,Helveticafont-size:18pxcolor:#aaa;  }   
  36. .circle:hover{ color:#f60;  }   
  37.   
  38.   
  39. /* 提示盒子 */  
  40. .tipBox{ width:200pxmargin-top:10px;   }   
  41. .tipBox .hd{ height:5px;  position:relative;  }   
  42. .tipBox .hd .arrow{ position:absolutetop:-5pxleft:10px; }   
  43. .tipBox .hd .arrow s{ top:-4px; }   
  44. .tipBox .bd{ border:1px solid #aaapadding:10px;  -webkit-border–    radius:5px; -moz-border-radius:5pxborder-radius:5px;  }   
  45. .tipBoxA .arrow s{ border-bottomcolor:#f6f6f6;  }   
  46. .tipBoxA .bd{ background:#f6f6f6;  }   
  47. </style>   
  48. <body>   
  49. <a class=“arrow arrowR”></a>   
  50. <a class=“arrow arrowL”></a>   
  51. <a class=“arrow arrowT”></a>   
  52. <a class=“arrow arrowB”></a>   
  53.   
  54. <a class=“arrow arrowR”><s></s></a>   
  55. <a class=“arrow arrowL”><s></s></a>   
  56. <a class=“arrow arrowT”><s></s></a>   
  57. <a class=“arrow arrowB”><s></s></a>   
  58.   
  59. <a class=“circle”>?</a>   
  60.   
  61. <div class=“tipBox”>   
  62. <div class=“hd”>   
  63. <s class=“arrow arrowT”><s></s></s>   
  64. </div>   
  65. <div class=“bd”>   
  66. 用css做的提示盒子,上三角是纯css,盒子圆角用到css3   
  67. </div>   
  68. </div>   
  69. <div class=“tipBox tipBoxA”>   
  70. <div class=“hd”>   
  71. <s class=“arrow arrowT”><s></s></s>   
  72. </div>   
  73. <div class=“bd”>   
  74. 用css做的提示盒子,上三角是纯css,盒子圆角用到css3   
  75. </div>   
  76. </div>   
  77. </body>   
  78.   
  79. </html>  
一波CSS制作的三角形和圆形小按钮示例

相关文章:

你感兴趣的文章:

标签云: