CSS3教程

当前位置: HTML5技术网 > CSS3教程 > 创意无限:纯CSS打造各种形状钻石

创意无限:纯CSS打造各种形状钻石

       网页因为 CSS 而呈现千变万化的风格。这一看似简单的样式语言在使用中非常灵活,只要你发挥创意就能实现很多比人想象不到的效果。特别是随着 CSS3 的广泛使用,更多新奇的 CSS 作品涌现出来。本文给大家带来 CSS 在网页中以及图形绘制中的使用。这篇文章给大家带来的是纯 CSS 绘制数学中的各种形状的砖石等。


  1. #infinity {

  2.     position: relative;

  3.     width: 212px;

  4.     height: 100px;

  5. }



  6. #infinity:before,

  7. #infinity:after {

  8.     content: "";

  9.     position: absolute;

  10.     top: 0;

  11.     left: 0;

  12.     width: 60px;

  13.     height: 60px;

  14.     border: 20px solid red;

  15.     -moz-border-radius: 50px 50px 0 50px;

  16.          border-radius: 50px 50px 0 50px;

  17.     -webkit-transform: rotate(-45deg);

  18.        -moz-transform: rotate(-45deg);

  19.         -ms-transform: rotate(-45deg);

  20.          -o-transform: rotate(-45deg);

  21.             transform: rotate(-45deg);

  22. }



  23. #infinity:after {

  24.     left: auto;

  25.     right: 0;

  26.     -moz-border-radius: 50px 50px 50px 0;

  27.          border-radius: 50px 50px 50px 0;

  28.     -webkit-transform: rotate(45deg);

  29.        -moz-transform: rotate(45deg);

  30.         -ms-transform: rotate(45deg);

  31.          -o-transform: rotate(45deg);

  32.             transform: rotate(45deg);

  33. }
复制代码


  1. #diamond {

  2.     width: 0;

  3.     height: 0;

  4.     border: 50px solid transparent;

  5.     border-bottom-color: red;

  6.     position: relative;

  7.     top: -50px;

  8. }

  9. #diamond:after {

  10.     content: '';

  11.     position: absolute;

  12.     left: -50px;

  13.     top: 50px;

  14.     width: 0;

  15.     height: 0;

  16.     border: 50px solid transparent;

  17.     border-top-color: red;

  18. }
复制代码


  1. #diamond-shield {

  2.     width: 0;

  3.     height: 0;

  4.     border: 50px solid transparent;

  5.     border-bottom: 20px solid red;

  6.     position: relative;

  7.     top: -50px;

  8. }

  9. #diamond-shield:after {

  10.     content: '';

  11.     position: absolute;

  12.     left: -50px; top: 20px;

  13.     width: 0;

  14.     height: 0;

  15.     border: 50px solid transparent;

  16.     border-top: 70px solid red;

  17. }
复制代码


  1. #diamond-narrow {

  2.     width: 0;

  3.     height: 0;

  4.     border: 50px solid transparent;

  5.     border-bottom: 70px solid red;

  6.     position: relative;

  7.     top: -50px;

  8. }

  9. #diamond-narrow:after {

  10.     content: '';

  11.     position: absolute;

  12.     left: -50px; top: 70px;

  13.     width: 0;

  14.     height: 0;

  15.     border: 50px solid transparent;

  16.     border-top: 70px solid red;

  17. }
复制代码




  1. #cut-diamond {

  2.     border-style: solid;

  3.     border-color: transparent transparent red transparent;

  4.     border-width: 0 25px 25px 25px;

  5.     height: 0;

  6.     width: 50px;

  7.     position: relative;

  8.     margin: 20px 0 50px 0;

  9. }

  10. #cut-diamond:after {

  11.     content: "";

  12.     position: absolute;

  13.     top: 25px;

  14.     left: -25px;

  15.     width: 0;

  16.     height: 0;

  17.     border-style: solid;

  18.     border-color: red transparent transparent transparent;

  19.     border-width: 70px 50px 0 50px;

  20. }
复制代码

关键词:HTML5、CSS



【创意无限:纯CSS打造各种形状钻石】相关文章

1. 创意无限:纯CSS打造各种形状钻石

2. 纯 CSS 绘制图形(各种形状的砖石)

3. 由纯CSS打造的Android机器人

4. 谷歌开源Gumbo:纯C语言实现的HTML5解析库

5. CSS 设置鼠标显示形状

6. 盈利模式探讨五:移动社交游戏潜力无限

7. 基于HTML5的无限循环放大场景

8. CSS里的各种水平垂直居中基础写法心得

9. 纯 CSS 绘制各种图形

10. Magic CSS3 – 创建各种神奇的交互动画效果

本文来源:https://www.51html5.com/a1002.html

点击展开全部

﹝创意无限:纯CSS打造各种形状钻石﹞相关内容

「创意无限:纯CSS打造各种形状钻石」相关专题

其它栏目

也许您还喜欢