之前初学css时从一位大佬哪儿了解到的一个挺有趣的功能 功能用到了transparent属性
transparent属性用来指定全透明色彩 transparent是全透明黑色 (black)的速记法,即一个类似rgba (0,0,0,0)这样的值。 在CSS1中,transparent被用来作为background-color的一个参数值,用于表示背景透明。
梯形代码如下:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
.box {
border-top: 40px solid blue;
border-left: 25px solid transparent;
border-right: 25px solid transparent;
height: 0;
width: 100px;
}
</style>
</head>
<body>
<div class="box">
</div>
</body>
</html>
三角形代码如下:
.box{
width: 0;
height: 0;
border-top: 50px solid black;
border-right: 50px solid transparent;
border-bottom: 50px solid transparent;
border-left: 50px solid transparent;
}
/*下面代码简单些*/
.box{
width: 0;
height: 0;
border: 50px solid transparent;
border-top-color: black ;
}