CSS Triangle (pine)

Source: Internet
Author: User

CSS Code section

*{margin:0; padding:0;} /* Simple Initialization */
#box {margin:0 auto; width:400px; background: #ccc; border:1px solid #000; padding-left:150px;}
#box1, #box2, #box3 {width:0; height:0; border-style:solid; Border-color: #ccc #ccc Green #ccc; }
#box1 {border-width:60px;border-top-width:0;margin-left:40px;}
#box2 {border-width:80px;border-top-width:0;margin-left:20px;}
#box3 {border-width:100px;border-top-width:0;}
#box4 {width:30px; height:200px; background:green; margin-left:85px;}

HTML code section:

<div id= "box" >
<div id= "Box1" ></div>
<div id= "Box2" ></div>
<div id= "Box3" ></div>
<div id= "Box4" ></div>
</div>

Implementation of the principle of analysis: the width of the box is set to 0, set the color of one side, so that the other three edges are consistent with the background color. Set the background color of the corresponding border for the arrow in which direction you want it to go.

CSS Triangle (pine)

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.