用css做三角形

<html>
<body>
<style>
.trlangle{
   width: 0;
   height: 0;
   border-left: 50px solid transparent;
   border-right: 50px solid transparent;
   border-bottom: 100px solid red;
}
</style>


<div class="trlangle"></div>
</body>
</html>

 2.

<html>
<body>
<style>
.triangle_border_up{
    width:0;
    height:0;
    border-width:0 30px 30px;
    border-style:solid;
    border-color:transparent transparent #333;/*透明 透明  灰*/
    margin:40px auto;
    position:relative;
}
.triangle_border_up span{
    display:block;
    width:0;
    height:0;
    border-width:0 28px 28px;
    border-style:solid;
    border-color:transparent transparent #fc0;/*透明 透明  黄*/
    position:absolute;
    top:0px;
    left:0px;
}
</style>


<div class="triangle_border_up">
    <span></span>
</div>
</body>
</html>
原文地址:https://www.cnblogs.com/PasserByOne/p/11598200.html