先上个效果看一下
代码如下
<!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>