您的位置:首页 > Web前端 > CSS

用css绘制基本图形

2018-01-05 11:46 435 查看
先上个效果看一下



代码如下

<!DOCTYPE html>
<html>
<head>
<title>用css制作图形</title>
<meta charset="utf-8">
<style type="text/css">
.square{
width:50px;
height:50px;
background:red;
float:left;

}
.rectangle{
width:50px;
height:20px;
float:left;
background:yellow;
}
.triangle{
width:0px;
height:0px;
float:left;
border:30px solid;
border-color:transparent transparent red transparent;
}
.circle
{
width:100px;
height:100px;
float:left;
background:yellow;
border-radius: 50px

}
.Trapezoid{
width:40px;
border:30px;

float:left;
border:30px solid;
border-color:red transparent transparent transparent;
}
.halfcircle
{
position:relative;
top:175px;
left:40px;
transform:rotate(270deg);
width:120px;
height:60px;
background:blue;
border-radius: 60px 60px 0px 0px
}

</style>
</head>
<body>
<div class="square">
</div>
<div class="rectangle">
</div>
<div class="triangle">
</div>
<div class="circle">
</div>
<div class="Trapezoid">
</div>
<div class="halfcircle">
</div>

</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: