Use css to draw triangles and css to draw triangles

Source: Internet
Author: User

Use css to draw triangles and css to draw triangles

When we create a pop-up layer for an image, we can use css to show a small arrow in the pop-up layer.

Use div to demonstrate

div{  border:12px solid;  berder-color:transparent green transparent transparent;  height:0;  width:0;}
In this way, a small triangle can be displayed.


The following code explains how to draw a triangle using div + css:

When you draw a block with a thick border but a size of 0
A diagonal edge is formed when the horizontal border and the vertical border are connected.
The angle of the Oblique Edge varies according to the width of the two adjacent edges.
 
How to Use CSS to draw triangles, as shown in the figure? Background and CSS3 cannot be used.

<Style>. div1 {width: 0px; height: 0px; border-top: 200px solid black; border-left: 200px solid white ;}. div2 {width: 0px; height: 0px; border-top: 197px solid white; border-left: 197px solid transparent; position: relative; top:-199px; left: 2px ;}. div1: before {width: 200px; border-top: 1px solid black; position: relative; left:-200px; top:-1px; content: ""; display: block ;}. div1: after {height: 200px; border-right: 1px solid black; posit Ion: relative; left:-200px; top:-201px; content: ""; display: block ;} </style> <body> <div class = "div1"> </div> <div class = "div2"> </div> </body> you like to pack your bags. go...
FF is qualified, and other browsers debug it slowly.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.