Implementation of CSS dialog box

Source: Internet
Author: User

Straight into the chase, here are the HTML parts of the two implementations:

1 <Divclass= "One">2     <em></em><span></span>    3 I am the first dialog box4 </Div>5 <Divclass= "both">6 I am the second dialog box7 </Div>

The first kind of CSS style is as follows:

1 /*One css Bubble box*/2 . One{3 position:relative;width:300px;Height:100px;Border:3px Solid #09f;4}5 . One em,. One span{6 position:Absolute;Top:100px; Left:20px;Display:Block;Border-width:15px;Border-style:Solid Dashed dashed;7}8 . One EM{9 Border-color:#09F Transparent Transparent;Ten} One . One span{ A Top:96px;Border-color:#FFF Transparent Transparent; -}

The second kind of CSS style is as follows:

/*The use of inheritance*/. the{position:relative;width:300px;Height:100px;Border:3px Solid #f60;background:#fff;}. Two::after{position:Absolute;Bottom:-12px; Left:20px;padding:8px;Border:Inherit;Border-left:None;Border-top:None;content:"";background:Inherit;
-webkit-transform:Rotate (45deg);-moz-transform:Rotate (45deg);Transform:Rotate (45deg);}

From the above code, it is not easy to see the second method, whether from HTML or CSS, are more concise. The second method uses a tag, using pseudo-classes and inheritance. It's not only easy to understand, but also easier to change.

Implementation of CSS dialog box

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.