zoukankan      html  css  js  c++  java
  • 理解纯CSS画三角形

    pure css draw a triangle

    我们有这样一个边框

    .d1 {

    200px;

    height: 200px;

    border-top: 10px solid yellow;

    border-left: 10px solid purple;

    border-bottom: 10px solid blue;

    border-right: 10px solid pink;

    }

     

    关键在于width的宽度高度必须设置为0四个角度的边框就会相互挤压

    .d2 {

    0;

    height: 200px;

    border-top: 10px solid yellow;

    border-left: 10px solid purple;

    border-bottom: 10px solid blue;

    border-right: 10px solid pink;

    }

     

    第三步:吧height改成0或者不设置也可以,会看到三角形啦,然后怎么只显示一个三角形呢?

    .d3 {

    0;

    /*height: 200px;*/

    border-top: 10px solid yellow;

    border-left: 10px solid purple;

    border-bottom: 10px solid blue;

    border-right: 10px solid pink;

    }

     

    第四步:还记得border的transparent透明属性么

    .d4 {

    0;

    /*height: 200px;*/

    border-top: 10px solid transparent;

    border-left: 10px solid transparent;

    border-bottom: 10px solid transparent;

    border-right: 10px solid pink;

    }

     

    .d5 {

    0;

    /*height: 200px;*/

    border-top: 10px solid yellow;

    border-left: 10px solid transparent;

    border-bottom: 10px solid transparent;

    border-right: 10px solid transparent;

    }

     

    .d6 {

    0;

    /*height: 200px;*/

    border-top: 10px solid transparent;

    border-left: 10px solid purple;

    border-bottom: 10px solid transparent;

    border-right: 10px solid transparent;

    }

     

    .d7 {

    0;

    /*height: 200px;*/

    border-top: 10px solid transparent;

    border-left: 10px solid transparent;

    border-bottom: 10px solid blue;

    border-right: 10px solid transparent;

    }

     

    关于画其他三角形,总结一句话:左边中,上中,右右,下下,意思就是,左边的三角形变大会往中间挤压,上面的额也是,右边的变大往右边挤压,下面的变大往下挤压

  • 相关阅读:
    禅道,导出选中的用例
    chrome 历史版本下载地址
    在QT中添加zeromq DLL库
    在QT中添加zeromq DLL库
    在QT中添加zeromq库,zeromq的下载编译
    工控软件dll劫持漏洞分析
    [转载]Impost3r:一款针对Linux的密码提取工具
    0MQ绑定Delphi版-说明
    通过Maven导出war包时报错:Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project Ocr: Error assembling WAR: webxml
    价值投资必须掌握的几个指标zz
  • 原文地址:https://www.cnblogs.com/timetimetime/p/7835960.html
Copyright © 2011-2022 走看看