css三角制作(二十课)
代码:
<style>
/* 边框原理 */
.box1 {
width: 0;
height: 0;
border-top: 100px solid pink;
border-bottom: 100px solid blue;
border-left: 100px solid yellow;
border-right: 100px solid greenyellow;
}
/* 三角制作 */
.box2 {
width: 0;
height: 0;
border: 100px solid transparent;
border-right: 100px solid greenyellow;
margin: 5px;
}
.jd {
position: relative;
width: 100px;
height: 100px;
background-color: pink;
}
.jd span {
position: absolute;
right: 10px;
top: -25px;
width: 0;
height: 0;
border: 10px solid transparent;
border-bottom: 10px solid greenyellow;
margin: 5px;
}
</style>
</head>
<body>
<div class="box1"></div>
<div class="box2"></div>
<div class="jd"><span></span></div>
</body>
</html>