Home > Web Front-end > CSS Tutorial > CSS and CSS3 implement drawing triangle elements

CSS and CSS3 implement drawing triangle elements

不言
Release: 2018-05-09 11:31:08
Original
1979 people have browsed it

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;
}
Copy after login

2: triangle-down

#triangle-down {
    width: 0;
    height: 0;
    border-left: 50px solid transparent;
    border-right: 50px solid transparent;
    border-top: 100px solid red;
}
Copy after login

3:triangle-left

#triangle-left {
    width: 0;
    height: 0;
    border-top: 50px solid transparent;
    border-right: 100px solid red;
    border-bottom: 50px solid transparent;
}
Copy after login

4:triangle-right

#triangle-right {
    width: 0;
    height: 0;
    border-top: 50px solid transparent;
    border-left: 100px solid red;
    border-bottom: 50px solid transparent;
}
Copy after login

5::triangle-topleft

#triangle-topleft {
    width: 0;
    height: 0;
    border-top: 100px solid red;
    border-right: 100px solid transparent;
}
Copy after login

6:triangle-topright

#triangle-topright {
    width: 0;
    height: 0;
    border-top: 100px solid red;
    border-left: 100px solid transparent; 
}
Copy after login

7:triangle-bottomleft

#triangle-bottomleft {
    width: 0;
    height: 0;
    border-bottom: 100px solid red;
    border-right: 100px solid transparent;
}
Copy after login

8:triangle-bottomright :

#triangle-bottomright {
    width: 0;
    height: 0;
    border-bottom: 100px solid red;
    border-left: 100px solid transparent;
}
Copy after login

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!

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