This article mainly introduces the CSS and CSS3 implementation of drawing triangle elements. It has a certain reference value. Now I share it with you. Friends in need can refer to it.
Occasionally, the front-end page needs to have a triangle icon Or triangle style. Nowadays, the triangles of icons are mostly implemented using font icons. However, some large triangle modules still need to be drawn using CSS styles on the front end. Here is the triangle CSS style code for various angles. I hope it can be useful to everyone. Help
1: triangle-up
#triangle-up { width: 0; height: 0; border-left: 50px solid transparent; border-right: 50px solid transparent; border-bottom: 100px solid red; }
2: triangle-down
#triangle-down { width: 0; height: 0; border-left: 50px solid transparent; border-right: 50px solid transparent; border-top: 100px solid red; }
3:triangle-left
#triangle-left { width: 0; height: 0; border-top: 50px solid transparent; border-right: 100px solid red; border-bottom: 50px solid transparent; }
4:triangle-right
#triangle-right { width: 0; height: 0; border-top: 50px solid transparent; border-left: 100px solid red; border-bottom: 50px solid transparent; }
5::triangle-topleft
#triangle-topleft { width: 0; height: 0; border-top: 100px solid red; border-right: 100px solid transparent; }
6:triangle-topright
#triangle-topright { width: 0; height: 0; border-top: 100px solid red; border-left: 100px solid transparent; }
7:triangle-bottomleft
#triangle-bottomleft { width: 0; height: 0; border-bottom: 100px solid red; border-right: 100px solid transparent; }
8:triangle-bottomright :
#triangle-bottomright { width: 0; height: 0; border-bottom: 100px solid red; border-left: 100px solid transparent; }
The above is the entire content of this article. For more related content, please pay attention to the PHP Chinese website.
Related recommendations:
CSS3 to achieve tilt and rotation animation effects
##
The above is the detailed content of CSS and CSS3 implement drawing triangle elements. For more information, please follow other related articles on the PHP Chinese website!