CSS之三角形的制作

用边框把宽高撑开,其他边设置为透明色或者背景色即可,再用position定位到任何地方去
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style type="text/css">
        .box{
            width: 0px;
            height: 0px;
            border-right: 100px solid transparent;
            border-left: 100px solid transparent;
            border-top: 100px solid transparent;
            border-bottom: 100px solid #000000;
        }
    </style>
</head>
<body>
<div class="box">

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

在这里插入图片描述

发布了44 篇原创文章 · 获赞 3 · 访问量 834

猜你喜欢

转载自blog.csdn.net/dwjdj/article/details/104106399