网页制作 
首页 > 网页制作 > 浏览文章

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

(编辑:jimmy 日期: 2024/6/1 浏览:3 次 )

参考了天猫、微博等网站的做法,用纯html和css实现,效果还是不错的。
以下是成果,兼容主流浏览器,包括ie6。
一波CSS制作的三角形和圆形小按钮示例

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:none; font:normal 12px/150% 宋体; }   
  13. body{ padding:20px; }   
  14. .arrow{ margin-bottom:20px;  }   
  15.   
  16. /* css三角形 */  
  17. .arrow,.arrow s { position:relative;  display:block; font-size: 0; line-            height: 0; width: 0; height: 0; border-color:transparent; border-style:dashed; border-width:5px; }   
  18. .arrowR,.arrowR s{ border-left-color:#aaa; border-left-style:solid; }   
  19. .arrowR s{ border-left-color:#fff; position:absolute; left:-7px; top:-5px; }   
  20. .arrowR:hover{ border-left-color:#f60;  }   
  21.   
  22. .arrowL,.arrowL s{ border-right-color:#aaa; border-right-style:solid; }   
  23. .arrowL s{ border-right-color:#fff; position:absolute; rightright:-7px; top:-5px; }   
  24. .arrowL:hover{ border-right-color:#f60;  }   
  25.   
  26. .arrowT,.arrowT s{ border-bottom-color:#aaa; border-bottom-style:solid; }   
  27. .arrowT s{ border-bottom-color:#fff; position:absolute; left:-5px; top:-3px; }   
  28. .arrowT:hover{ border-bottom-color:#f60;  }   
  29.   
  30. .arrowB,.arrowB s{ border-top-color:#aaa; border-top-style:solid; }   
  31. .arrowB s{ border-top-color:#fff; position:absolute; left:-5px; bottombottom:-3px; }   
  32. .arrowB:hover{ border-top-color:#f60;  }   
  33.   
  34. /* css圆形 */  
  35. .circle{ line-height:100%; overflow:hidden;  font-    family:Tahoma,Helvetica; font-size:18px; color:#aaa;  }   
  36. .circle:hover{ color:#f60;  }   
  37.   
  38.   
  39. /* 提示盒子 */  
  40. .tipBox{ width:200px; margin-top:10px;   }   
  41. .tipBox .hd{ height:5px;  position:relative;  }   
  42. .tipBox .hd .arrow{ position:absolute; top:-5px; left:10px; }   
  43. .tipBox .hd .arrow s{ top:-4px; }   
  44. .tipBox .bd{ border:1px solid #aaa; padding:10px;  -webkit-border-    radius:5px; -moz-border-radius:5px; border-radius:5px;  }   
  45. .tipBoxA .arrow s{ border-bottom-color:#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中选择器的逻辑处理
下一篇:详细解读CSS中的伪类after
一句话新闻
微软与英特尔等合作伙伴联合定义“AI PC”:键盘需配有Copilot物理按键
几个月来,英特尔、微软、AMD和其它厂商都在共同推动“AI PC”的想法,朝着更多的AI功能迈进。在近日,英特尔在台北举行的开发者活动中,也宣布了关于AI PC加速计划、新的PC开发者计划和独立硬件供应商计划。
在此次发布会上,英特尔还发布了全新的全新的酷睿Ultra Meteor Lake NUC开发套件,以及联合微软等合作伙伴联合定义“AI PC”的定义标准。
友情链接:杰晶网络 DDR爱好者之家 南强小屋 黑松山资源网 白云城资源网