ITPub博客

首页 > IT职业 > IT图书 > CSS3制作Freebie标签

CSS3制作Freebie标签

原创 IT图书 作者:chunzhisu 时间:2014-07-10 17:45:12 0 删除 编辑
  • CSS3制作Freebie标签,其中最有亮点的是使用css3来实现斜线背景以及方格背景,然后就是使用@font-face来制作icon图标。原理简单,重要的是思路,以及这两种背景实现的细节。



点击(此处)折叠或打开

  1. <!DOCTYPE HTML>
  2. <html lang=\"en-US\">
  3. <head>
  4. <meta charset=\"UTF-8\">
  5. <title>CSS3制作Freebie标签</title>
  6. <style type=\"text/css\">
  7. body{
  8. background-color: #f2f2f2;
  9. background-size:20px 20px,20px 20px,6px 6px,6px 6px;
  10. background-position:-2px -2px, -2px -2px,0 0, 3px 3px;
  11. background-image: -webkit-linear-gradient(white 2px, transparent 2px),
  12. -webkit-linear-gradient(0, white 2px, transparent 2px),
  13. -webkit-linear-gradient(45deg, #e6e6e6 25%, transparent 25%, transparent 75%, #e6e6e6 75%, #e6e6e6),
  14. -webkit-linear-gradient(45deg, #e6e6e6 25%, transparent 25%, transparent 75%, #e6e6e6 75%, #e6e6e6);
  15. background-image: -moz-linear-gradient(white 2px, transparent 2px),
  16.                   -moz-linear-gradient(0deg, white 2px, transparent 2px),
  17.                   -moz-linear-gradient(45deg, #e6e6e6 25%, transparent 25%, transparent 75%, #e6e6e6 75%, #e6e6e6),
  18.                   -moz-linear-gradient(45deg, #e6e6e6 25%, transparent 25%, transparent 75%, #e6e6e6 75%, #e6e6e6);
  19. background-image: -ms-linear-gradient(white 2px, transparent 2px),
  20.                   -ms-linear-gradient(0, white 2px, transparent 2px),
  21.                   -ms-linear-gradient(45deg, #e6e6e6 25%, transparent 25%, transparent 75%, #e6e6e6 75%, #e6e6e6),
  22.                   -ms-linear-gradient(45deg, #e6e6e6 25%, transparent 25%, transparent 75%, #e6e6e6 75%, #e6e6e6);
  23. background-image: -o-linear-gradient(white 2px, transparent 2px),
  24.                   -o-linear-gradient(0, white 2px, transparent 2px),
  25.                   -o-linear-gradient(45deg, #e6e6e6 25%, transparent 25%, transparent 75%, #e6e6e6 75%, #e6e6e6),
  26.                   -o-linear-gradient(45deg, #e6e6e6 25%, transparent 25%, transparent 75%, #e6e6e6 75%, #e6e6e6);
  27. background-image: linear-gradient(white 2px, transparent 2px),
  28.                   linear-gradient(0, white 2px, transparent 2px),
  29.                   linear-gradient(45deg, #e6e6e6 25%, transparent 25%, transparent 75%, #e6e6e6 75%, #e6e6e6),
  30.                   linear-gradient(45deg, #e6e6e6 25%, transparent 25%, transparent 75%, #e6e6e6 75%, #e6e6e6);
  31. }
  32. .box ul{
  33. margin-top: 100px;
  34. letter-spacing: -4px;
  35. word-spacing: -4px;
  36. font-size: 0;
  37. height:75px;
  38. text-align: center;
  39. box-shadow:0 -2px 3px rgba(0,0,0,.05),0 2px 3px rgba(0,0,0,.05);
  40. background:#fff;
  41. }
  42. .box li{
  43. letter-spacing: normal;
  44. word-spacing: normal;
  45. display:inline-block;
  46. *display: inline;
  47. zoom:1;
  48. position:relative;
  49. top:-5px;
  50. width:39px;
  51. height:48px;
  52. margin-right:40px;
  53. border-top:1px solid #66991f;
  54. border-left:1px solid #66991f;
  55. border-right:1px solid #66991f;
  56. overflow: hidden;
  57. background-color: #79b023;
  58. background-size:3px 3px;
  59. background-position: 0 0, 1px 1px;
  60. background-image: -webkit-linear-gradient(45deg, #91c32e 25%, transparent 25%, transparent 75%, #91c32e 75%, #91c32e),
  61.                   -webkit-linear-gradient(45deg, #91c32e 25%, transparent 25%, transparent 75%, #91c32e 75%, #91c32e);
  62. background-image: -moz-linear-gradient(45deg, #91c32e 25%, transparent 25%, transparent 75%, #91c32e 75%, #91c32e),
  63.                   -moz-linear-gradient(45deg, #91c32e 25%, transparent 25%, transparent 75%, #91c32e 75%, #91c32e);
  64. background-image: -ms-linear-gradient(45deg, #91c32e 25%, transparent 25%, transparent 75%, #91c32e 75%, #91c32e),
  65.                   -ms-linear-gradient(45deg, #91c32e 25%, transparent 25%, transparent 75%, #91c32e 75%, #91c32e);
  66. background-image: -o-linear-gradient(45deg, #91c32e 25%, transparent 25%, transparent 75%, #91c32e 75%, #91c32e),
  67.                   -o-linear-gradient(45deg, #91c32e 25%, transparent 25%, transparent 75%, #91c32e 75%, #91c32e);
  68. background-image: linear-gradient(45deg, #91c32e 25%, transparent 25%, transparent 75%, #91c32e 75%, #91c32e),
  69.                   linear-gradient(45deg, #91c32e 25%, transparent 25%, transparent 75%, #91c32e 75%, #91c32e);
  70. }
  71. .box li:last-child{ margin-right: 0;}
  72. .box li:after,.box li:before{
  73. position:absolute;
  74. display:block;    
  75. }
  76. .box li:before{
  77. top:5px;
  78. left: 5px;
  79. content: \"\";
  80. width: 28px;
  81. height: 0;
  82. line-height: 30px;
  83. color:rgba(69,124,12,.5);
  84. border-top: 1px dashed #5d8c1c;
  85. border-bottom: 1px dashed #b4d969;
  86. font-size: 18px;
  87. font-family: \'icomoon\';
  88. font-style: normal;
  89. speak: none;
  90. font-weight: normal;
  91. -webkit-font-smoothing: antialiased;
  92. }
  93. .box li:after{
  94. content:\"\";
  95. left:-1px;
  96. top:38px;
  97. width:38px;
  98. height:35px;
  99. box-shadow:1px 0 3px rgba(0,0,0,.3),0 -1px 3px rgba(0,0,0,.3);
  100. background:#fff;
  101. -webkit-transform:rotate(-45deg) skew(18deg,20deg);
  102. -moz-transform:rotate(-45deg) skew(18deg,20deg);
  103. -o-transform:rotate(-45deg) skew(18deg,20deg);
  104. -ms-transform:rotate(-45deg) skew(18deg,20deg);
  105. transform:rotate(-45deg) skew(18deg,20deg);
  106. }
  107. .box li:nth-child(1):before{
  108. content: \"\\21\";
  109. }
  110. .box li:nth-child(2):before{
  111. content: \"\\25\";
  112. }
  113. .box li:nth-child(3):before{
  114. content: \"\\24\";
  115. }
  116. .box li:nth-child(4):before{
  117. content: \"\\22\";
  118. }
  119. .box li:nth-child(5):before{
  120. content: \"\\26\";
  121. }
  122. @font-face {
  123. font-family: \'icomoon\';
  124. src:url(\'fonts/icomoon.eot\');
  125. src:url(\'fonts/icomoon.eot?#iefix\') format(\'embedded-opentype\'),
  126.       url(\'fonts/icomoon.svg#icomoon\') format(\'svg\'),
  127.       url(\'fonts/icomoon.woff\') format(\'woff\'),
  128.       url(\'fonts/icomoon.ttf\') format(\'truetype\');
  129. font-weight: normal;
  130. font-style: normal;
  131. }
  132.   </style>
  133. </head>
  134. <body>
  135. <div class=\"page\">
  136.   <header id=\"header\">
  137.     <hgrounp class=\"blank\">
  138.       <h1>CSS3制作Freebie标签</h1>
  139.       <h2>作者:藤藤(如有更好建议或疑问请加群:1041263)<h2>
  140.     </hgrounp>
  141.   </header>
  142.   <section class=\"demo\">
  143.     <div class=\"box\">
  144.       <ul class=\"nostyle\">
  145.         <li></li>
  146.         <li></li>
  147.         <li></li>
  148.         <li></li>
  149.         <li></li>
  150.       </ul>
  151.     </div>
  152.   </section>
  153. </div>
  154. </body>
  155. </html>


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29737856/viewspace-1215995/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: iPhone Checkbox Effect
请登录后发表评论 登录
全部评论

注册时间:2014-07-04

  • 博文量
    95
  • 访问量
    122233