js css html

如何利用边框绘制三角形

2023-12-20  本文已影响0人  莫思闲敏

第一种

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>如何利用边框绘制三角形</title>
    <style type="text/css">
        .box {
            width: 0px;
            height: 0px;
            border-top: 50px solid transparent;
            border-bottom: 50px solid blue;
            border-left: 50px solid transparent;
            border-right: 50px solid transparent;
        }
    </style>
</head>
<body>
    <div class="box"></div>
</body>
</html>

第二种

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>如何利用边框绘制三角形</title>
    <style type="text/css">
        .box {
            width: 0;
            height: 0;
            border: 50px solid transparent;
            border-bottom: 50px solid blue;
        }
    </style>
</head>
<body>
    <div class="box"></div>
</body>
</html>

练习项目 -- 原视频 https://www.bilibili.com/video/BV17x4y137g7?p=1&vd_source=55321cad1757f1bb77533a9972c8cd31

上一篇下一篇

猜你喜欢

热点阅读