您现在的位置: 万盛学电脑网 >> 程序编程 >> 网页制作 >> DivCSS教程 >> 正文

电脑知识吧分享纯 CSS 创建各种不同的图形形状

作者:佚名    责任编辑:admin    更新时间:2022-06-22

class="area">

   介绍

  今天,电脑知识吧分享纯 CSS 创建各种不同的图形形状,我们要学习如何使用简单的CSS来创建不同类型的平面图形。

 使用代码

  矩形

.rectangle {
width: 250px;
height: 150px;
background-color: #6DC75F;
}

<div></div>

  三角形

.triangleUp {
border-left: 75px solid transparent;
border-right: 75px solid transparent;
border-bottom: 150px solid #6DC75F;
width: 0;
height: 0;
}

<div class="triangleUp"></div>

  椭圆形

.oval {
width: 300px;
height: 150px;
background: #6DC75F;
-moz-border-radius: 150px / 75px;
-webkit-border-radius: 150px / 75px;
border-radius: 150px / 75px;
}

<div class="oval"></div>

  月牙形

.moon {
width: 150px;
height: 150px;
border-radius: 50%;
box-shadow: 15px 15px 0 0 green;
}

<div class="moon"></div>

  树叶

.leaf {
border-radius: 5px 300px 3px 300px;
background: #6DC75F;
width: 150px;
height: 150px;
}

<div class="leaf"></div>

 兴趣点

  CSS能让你完成很多令人惊艳的事情…祝大家编码愉快!