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;
    }
  • 相关阅读:
    如何保证最少消费一次redis的list队列数据
    如果设置Redis客户端的超时时长?
    REdis一致性方案探讨
    Linux后台开发工具箱-葵花宝典
    REdis主从复制之repl_backlog
    C++之Lambda研究
    Redis-5.0.5集群配置
    REdis之maxmemory解读
    [转载]centos6.3安装启动使用PostgreSQL 9.2
    [转载]linux环境变量设置方法总结(PATH/LD_LIBRARY_PATH)
  • 原文地址:https://www.cnblogs.com/passkey/p/10112219.html
Copyright © 2011-2022 走看看