Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use pseudo-class after to implement triangular Arrow in css

Shulou Source: shulou.com Published: 2022-06-01 04:01:08 10月02日 Update

Editor to share with you how css uses pseudo-class after to achieve triangular arrows. I hope you will get something after reading this article. Let's discuss it together.

Triangular arrowhead of pseudo-class after implementation

Implementation principle: set the border on three sides, the border in the direction pointed by the arrow does not need to be set, the border color on both sides of the arrow is transparent (transparent), and the opposite side is the main border color (larger) / main background color (smaller), because we need a triangular arrow with frame color. When the first arrow (larger) is accurately covered by the second arrow (smaller), the uncovered edge is the border of the composite triangular arrow, and its color is the color of the larger triangular arrow, which is adjustable. On the other hand, the color of the smaller triangular arrow should be set to the main color, and the frame of the main body should be covered when the negative positioning offset is made, so that it will be combined with the main body.

.arrow-left:before {z-index: 9999; content: "; display: block; width: 0; height: 0; border-top: 20px solid transparent; border-bottom: 20px solid transparent; border-right: 20px solid # E9E9E9; position: absolute; left:-20px; top: 80px;}

After reading this article, I believe you have a certain understanding of "how css uses pseudo-class after to achieve triangular arrows". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!

Tags: Arrows colors triangles borders main body larger that is articles no principle finished pointing direction more knowledge background industry negative values information channels Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple Redmi Docker OPPO Reno MySQL