Deep understanding of the differences between block-level elements and intra-row elements in CSS (personal error points), css error-prone

Source: Internet
Author: User

Deep understanding of the differences between block-level elements and intra-row elements in CSS (personal error points), css error-prone

Difference 1:

Block-level: a block-level element occupies only one row. By default, the width of the parent element is automatically filled with the width.

In-row: an element in a row does not exclusive to a row, and an element in an adjacent row is placed in the same row. The width varies with the content.

Difference 2:

Block level: You can set the width and height of block level elements.

Intra-row: Intra-row elements cannot be set in width or height.

Difference 3:

Block level: display: block;

Intra-row:Display: inline;

You can change the display attribute to block-level and intra-row elements.

Difference 4:

Block level: You can set margin and padding for block level elements.

In-row: margin-left in the horizontal direction of row elements; margin-right; padding-left; padding-right; can take effect. However, margin-bottom; margin-top; padding-bottom; in the vertical direction cannot take effect.

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.