zoukankan      html  css  js  c++  java
  • 纯CSS绘制三角形

    我们的网页因为 CSS 而呈现千变万化的风格。这一看似简单的样式语言在使用中非常灵活,只要你发挥创意就能实现很多比人想象不到的效果。特别是随着 CSS3 的广泛使用,更多新奇的 CSS 作品涌现出来。

    学会了一种css绘制方法后,绘制其他三角形的方法基本也是大同小异。

    1.向上

    img

    #triangle-up {
        width: 0;
        height: 0;
        border-left: 50px solid transparent;
        border-right: 50px solid transparent;
        border-bottom: 100px solid red;
    }

    2.向下

    img

    #triangle-down {
        width: 0;
        height: 0;
        border-left: 50px solid transparent;
        border-right: 50px solid transparent;
        border-top: 100px solid red;
    }

    3.向左

    img

    #triangle-left {
        width: 0;
        height: 0;
        border-top: 50px solid transparent;
        border-right: 100px solid red;
        border-bottom: 50px solid transparent;
    }

    4.向右

    img

    #triangle-right {
        width: 0;
        height: 0;
        border-top: 50px solid transparent;
        border-left: 100px solid red;
        border-bottom: 50px solid transparent;
    }

    5.左上

    img

    #triangle-topleft {
        width: 0;
        height: 0;
        border-top: 100px solid red;
        border-right: 100px solid transparent;
    }

    6.右上

    img

    #triangle-topright {
        width: 0;
        height: 0;
        border-top: 100px solid red;
        border-left: 100px solid transparent; 
    }

    7.左下

    img

    #triangle-bottomleft {
        width: 0;
        height: 0;
        border-bottom: 100px solid red;
        border-right: 100px solid transparent;
    }

    8.右下

    img

    #triangle-bottomright {
        width: 0;
        height: 0;
        border-bottom: 100px solid red;
        border-left: 100px solid transparent;
    }
  • 相关阅读:
    GmSSL 与 OpenSSL 共存的安装方法
    爬虫之ssh证书警告错误
    逆向so文件调试工具IDA基础知识点
    frida- registernatives获取so层动态注册函数
    绑定方法与非绑定方法, 反射
    Elk stack安装部署
    类的继承和组合
    安装部署kafka和zookeeper集群(三节点)
    ELK stack 生产问题
    Elasticsearch删除数据操作,你必须知道的一些坑
  • 原文地址:https://www.cnblogs.com/passkey/p/10112219.html
Copyright © 2011-2022 走看看