Display: inline-block in CSS

Source: Internet
Author: User
ArticleDirectory
    • 1. display: inline-block
    • 2. inline-block in IE
    • 3. Other browsers
    • 4. References
    • 1. display: inline-block
    • 2. inline-block in IE
    • 3. Other browsers
    • 4. References
1. display: inline-block

Let an element have the attribute of "block element" (width and height can be set), but also the attribute of "inline element" (no line feed is generated ).

2. inline-block in IE

IE6 does not support this attribute, but IE8 starts to support this attribute.

Enable the inline-block feature for IE6 inline Elements

Because inline-block triggers ie layout, you only need to set {display: inline-block;} in IE6.

There are two ways to make the IE6 block element have the inline-block attribute

A. You can trigger layout first and then set it to inline. Note that the two displays must be valid only in the two CSS declarations,CodeAs follows:

 
Div {width: 400px; Height: 200px; display: inline-block;} Div {display: inline ;}

B. Set it to inline directly, and use zoom to trigger layout to achieve similar results:

Div {width: 400px; Height: 200px; * display: inline; * ZOOM: 1 ;}
3. Other browsers

Other browsers support this attribute, but Firefox only supports this attribute from 3.0. For earlier versions, you can use its private attribute {display: -Moz-inline-box} to achieve similar results, but you can ignore versions earlier than 3.0 (these versions are rarely used by browsers ).

4. References
    • CSS {display: inline-block}

 

 

 

1. display: inline-block

Let an element have the attribute of "block element" (width and height can be set), but also the attribute of "inline element" (no line feed is generated ).

2. inline-block in IE

IE6 does not support this attribute, but IE8 starts to support this attribute.

Enable the inline-block feature for IE6 inline Elements

Because inline-block triggers ie layout, you only need to set {display: inline-block;} in IE6.

There are two ways to make the IE6 block element have the inline-block attribute

A. You can trigger layout first and then set it to inline. Note that the two displays must be valid only in the two CSS declarations. The Code is as follows:

Div {width: 400px; Height: 200px; display: inline-block;} Div {display: inline ;}

B. Set it to inline directly, and use zoom to trigger layout to achieve similar results:

 
Div {width: 400px; Height: 200px; * display: inline; * ZOOM: 1 ;}
3. Other browsers

Other browsers support this attribute, but Firefox only supports this attribute from 3.0. For earlier versions, you can use its private attribute {display: -Moz-inline-box} to achieve similar results, but you can ignore versions earlier than 3.0 (these versions are rarely used by browsers ).

4. References
    • CSS {display: inline-block}
Related Article

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.