css--base block-level elements and inline elements

Source: Internet
Author: User

In CSS, tag elements in HTML are broadly divided into three different types: block elements, inline elements (also called inline elements), and inline block elements. In HTML and XHTML, block-level elements cannot inherit inner elements (that is, they cannot be nested within inline elements), <p>i like <em>it</em></p> is the correct notation, but <em>i like <p>it</p></em> is not correct.

The most common block elements are:

<div>, <p>,

The commonly used inline elements are:

<a>, <span>, <br>, <i>, <em>, <strong>, <label>, <q>, <var>, < Cite>, <code>

The commonly used inline block elements are:

, <input>

* Can be set to display:block display inline elements as block-level elements. block elements can also display:inline be set to inline elements by code .

* Block-level element features:

1. Each block-level element starts with a new line, and the subsequent element also begins a row.

2, the height of the element, width, row height, and the top and bottom margin can be set.

3, the element width is not set, is its own parent container of 100% (and the width of the parent element consistent), unless a width is set.

* Inline Element Features:

1, and other elements are on one line;

2, the height of the element, the width and the top and bottom margin is not set;

3. The width of the element is the width of the text or Picture it contains, and it cannot be changed.

Inline block elements (Inline-block) are features that have inline elements, block elements, and code that display:inline-block sets elements as inline block elements

* Inline block Element element features:

1, and other elements are on one line;

2, the height of the element, width, row height, and the top and bottom margin can be set.

css--base block-level elements and 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.