纯 CSS 创建各种不同的图形形状

网友投稿 746 2022-07-29

介绍

纯 CSS 创建各种不同的图形形状

今天,我们要学习如何使用简单的CSS来创建不同类型的平面图形。

使用代码

矩形

.rectangle {

width: 250px;

height: 150px;

background-color: #6DC75F;

}

三角形

.triangleUp {

border-left: 75px solid transparent;

border-right: 75px solid transparent;

border-bottom: 150px solid #6DC75F;

width: 0;

height: 0;

}

椭圆形

.oval {

width: 300px;

height: 150px;

background: #6DC75F;

-moz-border-radius: 150px / 75px;

-webkit-border-radius: 150px / 75px;

border-radius: 150px / 75px;

}

月牙形

.moon {

width: 150px;

height: 150px;

border-radius: 50%;

box-shadow: 15px 15px 0 0 green;

}

树叶

.leaf {

border-radius: 5px 300px 3px 300px;

background: #6DC75F;

width: 150px;

height: 150px;

}

兴趣点

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

原文:How to create different shapes in html using css 译文:codeceo

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:为什么要提升web性能?(对web服务器提高性能)
下一篇:HTML5的这些api你知道吗?(html5+api)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~