• CSS3写常用的形状


    正方形:

     1 .square{  100px;height: 100px; background: #E57779;} 

     

    长方形:

     1 .rectangle{ width: 200px;height: 100px; background: #E57779;} 

     

    圆形:

    1 .circle{ width: 100px;height: 100px;background: #E57779;
    2      border-radius: 50%; 
    3 }
     

    椭圆形:

    1 .oval{ width: 200px; height: 100px; background: #E57779;
    2         border-radius: 50%;
    3 }
     

    三角形-上:

    1 /*三角形-上
    2  * 左右下,下为左右宽度的2倍*/
    3 
    4 .triangle_t{width: 0;height: 0; 
    5     border-left: 50px solid transparent;
    6     border-right: 50px solid transparent;
    7     border-bottom: 100px solid #E57779;
    8 }
     

    三角形-下:

    1 /*三角形-下
    2  * 左右上,上为左右宽度的2倍*/
    3 .triangle_b{width: 0;height: 0;
    4     border-left: 50px solid transparent;
    5     border-right: 50px solid transparent;
    6     border-top: 100px solid #E57779;
    7 }
     

    三角形-左:

    1 /*三角形-左
    2  * 上下右,右为上下宽度的2倍*/
    3 .triangle_l{width: 0;height: 0;
    4         border-top: 50px solid transparent;
    5         border-right: 100px solid #E57779;
    6         border-bottom: 50px solid transparent;
    7 }
     

    三角形-右:

    1 /*三角形-右
    2  * 上下左,左为上下宽度的2倍*/
    3 .triangle_r{width: 0;height: 0; 
    4     border-top: 50px solid transparent;
    5     border-left: 100px solid #E57779;
    6     border-bottom: 50px solid transparent;
    7 }
     

    对话泡泡:

     1 /*对话泡泡=小三角+长方形
     2  *对话泡泡-长方形
     3  *  */
     4 .talkboxes{ width: 200px; height: 100px; background: #E57779;
     5      border-radius: 15px;
     6      position: relative;
     7  }
     8  /*对话泡泡=小三角+长方形
     9  *对话泡泡-小三角
    10  *  */
    11  .talkboxes:before{  width: 0; height: 0;
    12      content: " ";
    13     position: absolute;
    14     top: -26px;
    15     left: calc(50% - 13px);
    16     border-left: 13px solid transparent;
    17     border-bottom: 26px solid #E57779;
    18     border-right: 13px solid transparent;
    19 }
     

    六边形:

     1 /*六边形=上三角+长方形+下三角
     2  * 六边形-上三角
     3  * */
     4 .sexangle:before{width: 0;height: 0;
     5     content: " ";
     6     position: absolute;
     7     top:-30px;
     8     border-left: 50px solid transparent;
     9     border-right: 50px solid transparent;
    10     border-bottom: 30px solid #E57779;
    11 }
    12 /*六边形=上三角+长方形+下三角
    13  * 六边形-长方形
    14  * */
    15 .sexangle{ width: 100px; height: 55px; background: #E57779;position: relative;top: 25px;}
    16 /*六边形=上三角+长方形+下三角
    17  * 六边形-下三角
    18  * */
    19 .sexangle:after{width: 0;height: 0;
    20     content: " ";
    21     position: absolute;
    22     bottom:-30px;
    23     border-left: 50px solid transparent;
    24     border-right: 50px solid transparent;
    25     border-top: 30px solid #E57779;
    26 }

     



    六边形1:
     1 .sexangle1:before{width: 100px; height: 63px; background: #E57779;
     2     content: " ";
     3     display: block;
     4     transform:rotate(-60deg);
     5     border-radius: 10px;
     6 }
     7 .sexangle1{ width: 100px; height: 63px; background: #E57779;margin-top: 30px;
     8     position: relative;
     9     transform:rotate(30deg);
    10     border-radius: 10px;
    11 
    12 }
    13 .sexangle1:after{width: 100px; height: 63px; background: #E57779;
    14     content: " ";
    15     display: block;
    16     position: absolute;
    17     top: 0;
    18     transform:rotate(60deg);
    19     border-radius: 10px;
    20 }

     
  • 相关阅读:
    Android中的“再按一次返回键退出程序”代码实现
    Android UI编程之自定义控件初步——ImageButton
    21岁,我想当“大帅”
    茑萝改变了我
    茑萝,梦想的加油站
    放弃了我的国企工作
    性能调优之访问日志IO性能优化
    性能调优之提高 ASP.NET Web 应用性能的 24 种方法和技巧
    性能调优之剖析OutOfMemoryError
    老李分享:单元测试检查清单:让测试有效,避免致命错误
  • 原文地址:https://www.cnblogs.com/BaishangBloom/p/4643658.html
Copyright © 2020-2023  润新知