The difference between inline and block-level elements is described in detail

Source: Internet
Author: User
First, the CSS specification specifies that each element has a display property, determines the type of the element, and each element has a default display value, block-level, inline (inline).

Block-level elements: (The following list of more commonly used block-level elements, details can be found in W3cschool query)

<p> define a partition or section in a document   

Inline elements: (The following lists the more commonly used inline elements, details can be found in the W3cschool query)

<a> define Hyperlinks   <b> font bold   <span> define inline elements in a document    insert a title image into a Web page   <input> input Box   <small> Small font effects   <br> line wrapping   <big> font enlargement   <strong> accent Tone   <select> Create a single or multiple-selection menu   <textarea> define text fields, multiple lines of text input controls

The difference between an inline element and a block-level element:

1. Inline elements and block-level functions can be converted to each other by modifying the display property values to toggle block-level elements and inline elements, inline element Display:inline, and block-level element Display:block.

2. Inline elements and other inline elements will be arranged on a horizontal line, all in the same row;

Block-level elements are always arranged on a new line, with each block-level element exclusive of one row, arranged vertically, and left-and-right (float:left/right) to align horizontally if you want to sort horizontally.

3. Inline elements can not be set wide, width height varies with the text content, but can set the line height (line-height), while setting margin margin is invalid, left and right, the inner padding padding up and down invalid, right and left effective;

Block-level elements can be set wide, and width height and margin, inner padding can be arbitrarily controlled.

4. Block-level elements can include inline and block-level elements, as well as inline elements and other elements;

Inline elements cannot contain block-level elements, only text or other inline elements.

Above this comprehensive understanding of the line elements and block-level elements of the difference is the small part of the whole content to share to everyone, I hope to give you a reference, but also hope that we support topic.alibabacloud.com.

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.