CSS: Element types

Source: Internet
Author: User

Element classification

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.

Block element

<div>, <p>,

Characteristics
    • Each block-level element begins with a new row, and the subsequent element also starts another line.
    • The height, width, row height, and top and bottom margins of an element can be set.
    • The element width is not set, and is 100% of the parent container (and the width of the parent element), unless a width is set.
Inline elements are converted into block elements
/* Make a element a block element feature */a{   
Inline elements

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

Characteristics
    • And the other elements are on one line;
    • The height, width and top and bottom margins of the element are not set;
    • The width of the element is the width of the text or Picture it contains, and it cannot be changed.
Block elements converted to inline elements
/ * block element Div converted to inline element */div{     display:inline;    } ... < Div > became an inline element of my </div>

Inline block Element (Inline-block)

, <input>

Characteristics
    • is the characteristics of inline elements and blocky elements.
    • And the other elements are on one line;
    • The height, width, row height, and top and bottom margins of an element can be set

Study Notes Reference:

Some of the core concepts of CSS

CSS Learning Notes

CSS: Element types

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.