CSS Inline with block

Source: Internet
Author: User

Inline elements can be understood to not directly set width and height elements, such as span, and you have no effect on the width and height you set for him unless you set it to block-level elements.

The width and height will not work if the following code removes the Display:block property value.

1 <spanstyle="width:100px;height:100px;display:block;"></span>

Margin controls the spacing between inline and block-level elements, not just inline elements.

It is important to note the conversion issues between them, such as block-level elements plus the float property becoming inline elements.

--------------------------------------------------------------------------------------------------------------- -----

The maximum property values used by display are: Blocks (block-level elements), inline (inline elements), inline-block (inline block elements)

It's easy to say:

Block-level elements (blocks): can be set wide height, margin,padding value, etc.;

12 <div>我是块级元素DIV!</div><p>我是块级元素P!</p>

The result of the above display:

12 我是块级元素DIV!我是块级元素P!

inline element (inline): Can not set width height, margin,padding value, etc.;

12 <span>我是内联元素SPAN!</span><em>我是内联元素EM!</em>

The results shown above (will appear in a row, when you set the width high, the margin,padding value does not work):

1 我是内联元素SPAN!我是内联元素EM!

Inline block Element (Inline-block): You can set the width height, margin,padding value

12 <span>我是内联元素SPAN!</span><em>我是内联元素EM!</em>

Css:

1 span,em { padding05pxdisplay: inline-block;}

The effect shown above will be in a row, but at the same time the width is high, the margin,padding value also works;

1  我是内联元素SPAN!  我是内联元素EM!

CSS Inline with block

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.