zoukankan      html  css  js  c++  java
  • CSS通过边框border-style来写小三角

    <!DOCTYPE html>
    /*直接复制代码即可在浏览器验证*/

    <html>
    <head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <style>
    * {
    margin: 0;
    padding: 0;
    }
    /*盒子的样式*/
    .box {
    position: relative;
    margin: 20px auto;
    height: 200px;
    200px;
    background: rgba(0, 0, 0, 0.5);
    }
    /*利用border-style实现*/
    .drop-down {
    position: absolute;
    top: 10px;
    left: 10px;
    height: 0;
    0;
    border: 3px;
    /*style依次是上边框、右、下、左*/
    border-style: solid dashed dashed dashed;
    /*想实现向下的三角就把上边框设置为实现其余几个边框都是虚线并且颜色设置为透明*/
    border-left-color: transparent;
    border-right-color: transparent;
    border-bottom-color: transparent;
    color: #fff;
    }

    /*再来写个三角向右的例子*/
    .right {
    position: absolute;
    top: 10px;
    left: 30px;
    height: 0;
    0;
    border:10px;
    border-style:dashed dashed dashed solid;
    border-top-color: transparent;
    border-right-color: transparent;
    border-bottom-color: transparent;
    color: yellowgreen;
    }


    </style>
    </head>
    <body>
    <!--先写个盒子加上黑色背景,来和生成的小三角来做下对比-->
    <div class="box">
    <i class="drop-down"></i>
    <i class="right"></i>
    </div>

    </body>
    </html>



  • 相关阅读:
    洛谷 2574 XOR的艺术
    洛谷 1774 最接近神的人
    洛谷 3398 仓鼠找sugar 【模板】判断树上两链有交
    洛谷 2440 木材加工
    洛谷 1824 进击的奶牛
    洛谷 1873 砍树
    洛谷 1577 切绳子
    51nod1485 字母排序
    51nod1055 最长等差数列
    51nod1128 正整数分组V2
  • 原文地址:https://www.cnblogs.com/wangying731/p/5170241.html
Copyright © 2011-2022 走看看