zoukankan      html  css  js  c++  java
  • 1. css画三角形

    1.先画一个正方形,启发一下如何画上三角、下三角、左三角以及右三角。

    <div class="square"></div>
    .square{
      0; 
     height: 0;
     border- 100px;
     border-style: solid;
     border-color:#FFCCCC #0099CC #996699 #339933;
    }

    效果图如下:

    2.上三角画法:

    <div class="triangle"></div>
    .triangle{
      0; 
     height: 0;
     border- 100px;
     border-style: solid;
     border-color: transparent transparent #FFCCCC transparent;
    }

    3.下三角:

    <div class="triangle"></div>
    .triangle{
      0; 
     height: 0;
     border- 100px;
     border-style: solid;
     border-color: #ff0000 transparent transparent transparent;
    }

    4.左三角:

    <div class="triangle"></div>
    .triangle{
      0; 
     height: 0;
     border- 100px;
     border-style: solid;
     border-color:  transparent #ff0000 transparent transparent;
    }

    5.右三角:

    <div class="triangle"></div>
    .triangle{
      0; 
     height: 0;
     border- 100px;
     border-style: solid;
     border-color:  transparent transparent transparent  #ff0000;
    }

    6.伪类画三角形:

    <div></div>
    div{
        position: relative;
        220px;
        height:60px;
        margin:50px auto;
        padding:5px;
        border:1px solid #d9d9d9;
        border-radius:4px;
        box-sizing:border-box;
    }
    div:before{
        position:absolute;
        left:20px;
        top:0;
        margin-top:-20px;
        content:"";
        border:10px solid transparent;
        border-bottom-color:#d9d9d9;
       
    
    }
    div:after{
        position: absolute;
        top:0;
        left:20px;
        margin-top:-19px;
        content:"";
        border:10px solid transparent;
        border-bottom-color:#fff;
    }

    效果图如下:

  • 相关阅读:
    SPSS分类分析:决策树
    单例设计模式
    设计模式
    java.lang.NoClassDefFoundError: org/apache/zookeeper/proto/SetWatches
    AngularJs中Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.3.15/
    如何在linux环境下配置环境变量
    MQ的面试题
    VUE框架
    SQL中and和or的区别是?
    Git的工作流程
  • 原文地址:https://www.cnblogs.com/linjiu0505/p/11850542.html
Copyright © 2011-2022 走看看