Home > Web Front-end > HTML Tutorial > Use css to create triangles

Use css to create triangles

WBOY
Release: 2016-08-10 08:49:42
Original
1215 people have browsed it

html代码:

css代码:

.div{
border-top:40px solid #ff0077;
border-left:40px solid #004444;
border-bottom:40px solid #999999;
border-right:40px solid #333333;
height: 0px;
width: 0px;
}

效果:

 

 

现在一个一个分解出来

html代码:




 

css代码:

.triggle-top,.triggle-left,.triggle-bottom,.triggle-right{
border:100px solid transparent;
height: 0;
width: 0;
}
.triggle-top{
border-top-color:#ff0077;
}
.triggle-left{
border-left-color:#004444;
}
.triggle-bottom{
border-bottom-color:#999999;
}
.triggle-right{
border-right-color: #333333;
}

 

效果图:

 

 

 

 

总之:制作小三角是利用border属性来制作的

 

 

额外:

还有我想说的就是一般一个标签比如:

这个删除x可以用:after{content:'x'}来实现

 

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template