正三角
HTML:
<div class="box1"></div>
<div class="box2"></div>
<div class="box3"></div>
<div class="box4"></div>
CSS:
* {
margin: 0;
padding: 0;
}
.box1 {
margin: 30px;
width: 0px;
height: 0px;
border: 30px solid;
border-color: yellow transparent transparent transparent;
}
.box2 {
margin: 30px;
width: 0px;
height: 0px;
border: 30px solid;
border-color: transparent yellow transparent transparent;
}
.box3 {
margin: 30px;
width: 0px;
height: 0px;
border: 30px solid;
border-color: transparent transparent yellow transparent;
}
.box4 {
margin: 30px;
width: 0px;
height: 0px;
border: 30px solid;
border-color: transparent transparent transparent yellow;
}
倾斜的三角
HTML
<div class="box1"></div>
<div class="box2"></div>
<div class="box3"></div>
CSS
.box1 {
margin: 30px;
width: 0px;
height: 0px;
border: 30px solid;
border-bottom: none;
border-color: transparent yellow transparent transparent;
}
.box2 {
margin: 30px;
width: 0px;
height: 0px;
border: 30px solid;
border-bottom: none;
border-right: 40px solid;
border-color: transparent yellow transparent transparent;
}
.box3 {
margin: 30px;
width: 0px;
height: 0px;
border: 30px solid;
border-bottom: none;
border-right: 20px solid;
border-color: transparent yellow transparent transparent;
}
.box1 {
margin: 30px;
width: 0px;
height: 0px;
border: 30px solid;
border-bottom: none;
border-right: 20px solid;
border-color: transparent transparent transparent yellow;
}
.box2 {
margin: 30px;
width: 0px;
height: 0px;
border: 30px solid;
border-bottom: none;
border-left: 40px solid;
border-color: transparent transparent transparent yellow;
}
.box3 {
margin: 30px;
width: 0px;
height: 0px;
border: 30px solid;
border-bottom: none;
border-right: 20px solid;
border-color: transparent transparent transparent yellow;
}
.box1 {
margin: 30px;
width: 0px;
height: 0px;
border: 30px solid;
border-top: none;
border-right: 20px solid;
border-color: transparent transparent transparent yellow;
}
.box2 {
margin: 30px;
width: 0px;
height: 0px;
border: 30px solid;
border-top: none;
border-right: 20px solid;
border-color: transparent yellow transparent transparent;
}
圆形
<ul>
<li class="circle1">上边圆</li>
<li class="circle2">左边圆</li>
<li class="circle3">下边圆</li>
<li class="circle4">左边圆</li>
<li class="circle5">全圆</li>
</ul>
* {
margin: 0;
padding: 0;
}
ul li {
list-style: none;
float: left;
margin-left: 20px;
margin-top: 50px;
text-align: center;
}
li {
background: red;
}
.circle1 {
width: 100px;
height: 50px;
border-radius: 50px 50px 0 0;
line-height: 50px;
}
.circle3 {
width: 100px;
height: 50px;
border-radius: 0 0 50px 50px;
line-height: 50px;
}
.circle2 {
width: 50px;
height: 100px;
border-radius: 0 50px 50px 0;
line-height: 100px;
}
.circle4 {
width: 50px;
height: 100px;
border-radius: 50px 0 0 50px;
line-height: 100px;
}
.circle5 {
width: 100px;
height: 100px;
border-radius: 50px;
line-height: 100px;
}