zoukankan      html  css  js  c++  java
  • 纯css实现三角形

    在设计界面的时候,通常需要三角形的图标,一般做法是用图片,其实也可以使用css来实现。如下:


    向上的三角形

     

    向右的三角形

     

    向下的三角形

     

    向左的三角形

     

    实现它们的css分别是:

    1 .top{
    2     width: 0;
    3     height: 0;
    4     border-color: transparent transparent #333 transparent;
    5     border-width: 6px;
    6     border-style: solid;
    7 }
    1 .right {
    2     width: 0;
    3     height: 0;
    4     border-color: transparent transparent transparent #333;
    5     border-width: 6px;
    6     border-style: solid;
    7 }
    1 .down {
    2     width: 0;
    3     height: 0;
    4     border-color: #333 transparent transparent transparent;
    5     border-width: 6px;
    6     border-style: solid;
    7 }
    1 .left {
    2     width: 0;
    3     height: 0;
    4     border-color: transparent #333 transparent transparent;
    5     border-width: 6px;
    6     border-style: solid;
    7 }

    其中用到的border-color:transparent是只有在奇葩的IE6下才支持,所以可以放心使用

  • 相关阅读:
    4.内核编译和裁剪
    2.Linux技能要求
    3.字符驱动框架
    1.Linux命令
    4.类和抽象
    3.指针
    2.C++语言特性
    1.编译器
    计数排序——Counting Sort
    网关、网桥、路由器、集线器
  • 原文地址:https://www.cnblogs.com/dacuotecuo/p/3854501.html
Copyright © 2011-2022 走看看