CSS block elements and inline elements

Source: Internet
Author: User

In the CSS layout page, we will divide the HTML tags into two, block elements and inline elements (we usually use the div and P is a block element, link tag A is an inline element)

Block element
It is generally a container for other elements that can hold inline elements and other blocky elements, and block elements repel other elements to the same line, with width (width) height (height) in effect. Common block elements are div and p.

Inline elements
Inline elements can only hold text or other inline elements, which allow other inline elements to be on the same line, but the width height (height) does not work. Common inline elements are "a"

Block element Inline elements
Whether to allow other elements to be in the same row No Yes
Whether width and height work Yes No


Address-Address
BLOCKQUOTE-block reference
Center-for aligning
Dir-directory list
Div-Common block-level easy, also the main label for CSS layout
DL-definition list
Fieldset-form control group
form-interactive form
H1 -Large title
H2-subtitle
h3-3 level title
H4-4 level title
H5-5 level title
H6-6 level title
hr-Horizontal divider
Isindex-input prompt
Menu-dish Single-column table
Noframes-frames optional content (this chunk content is displayed for browsers that do not support frame
NoScript-Optional script content (this content is displayed for browsers that do not support script)
ol-Sort form
P-paragraph
Pre-formatted Text
Table-table
ul-non-sorted list

Inline elements (inline element) include
A-anchor point
ABBR-Abbreviation
Acronym-the first word
B-Bold (not recommended)
Bdo-bidi Override
Big-Large font
BR-line break
Cite-citation
Code-Computer codes (required when referencing source)
DFN-Defining fields
EM-emphasize
Font-typeface settings (not recommended)
I-Italic
IMG-Images
Input-Enter box
KBD-Define keyboard text
Label-Table Label
Q-Short Reference
S-Medium dash (not recommended)
Samp-Define sample computer code
Select-Project Selection
Small-Small font text
Span-a common inline container that defines chunks within a text
Strike-Medium Dash
Strong-Bold Emphasis
Sub-subscript
SUP-Superscript
TEXTAREA-Multi-line text input box
TT-Telex text
U-Underline
var-Defining variables

* block elements and inline elements transform each other

Block elements into inline elements:CSS settings display:inline ;

Inline elements into blocky elements: CSS settings display:block;

Example:

CSS block 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.