border三角形的3种方式

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
*{
margin: 0;
padding: 0;
border: 0;
}
.box{
400px;
height: 200px;
border-radius: 30px;
border: 4px solid yellowgreen;
margin: 200px;
background: #fff;
position: relative;
z-index: 100;
}

第一种方式;
.box:after{
content: "";
40px;
height: 40px;
border: 4px solid yellowgreen;
border-bottom-color: transparent;
border-left-color: transparent;
position: absolute;
right: 40px;
top: -24px;
margin: auto;
background: #fff;
transform: rotateZ(-45deg);

}

第二种方式;

.triangle_border_down span{

    display:block;
    0;
    height:0;
    border-28px 28px 0;
    border-style:solid;
    border-color:#fc0 transparent transparent;/*黄 透明 透明 */
    position:absolute;
    top:0px;
    left:0px;
}
 
第三种方式;
#box{
  0px;
  height:0px;
  border-top: 20px solid red;
  border-right:20px solid transparent;
  border-bottom:20px solid transparent;
  border-left:20px solid red;
}


</style>
</head>
<body>
<div class="box">

<span><span>
</div>
</body>
</html>

原文地址:https://www.cnblogs.com/fengyuzhen34/p/9776577.html