The understanding of CSS block elements and inline elements (inline elements)

Source: Internet
Author: User

Block elements:

It is generally the container element of other elements, can accommodate block elements and inline elements, which by default will not be the same line with other elements, that is, the equivalent of two blocks are written together vertically layout. The most common is div and P

Inline elements:

Inline element is also called inline element, it can only accommodate text and other inline elements, common inline elements have hyperlinks, a, span, img

The difference between the inline element and the block element is that the inline element does not start from the new line, and the horizontal direction is followed.

Each block element will start from the new line.

Emphasize: Display:block;  Float:left/right; When a CSS defines one of these two properties for an inline element, the elements in these rows will have a block element attribute! For example, you start with a new line, just like a newline character followed, and have the height and width properties.

If you want to make a block element into an inner element, just add display:inline to the CSS.

The understanding of CSS block elements and inline elements (inline elements)

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.