You don't know the difference between block and inline in CSS (GO)

Source: Internet
Author: User

All HTML elements are part of block and inline.


The block element is characterized by:
(1) always start on a new line;
(2) Height, row height and top and bottom margin can be controlled;
(3) The width default is 100% of its container, unless a width is set
<div>, <p>,
Conversely, the inline element is characterized by:
(1) and other elements are on one line;
(2) High, row height and top and bottom margin can not be changed;
(3) Width is the width of the text or picture, and it cannot be changed.
<span>, <a>, <label>, <input>, , <strong> and <em> are examples of inline elements.

This feature of an element can be changed with the Display:inline or Display:block command. When do I need to change this attribute?
Let an inline element start from the new line;
Keep The block elements and other elements on one line;
Controls the width of the inline element (especially useful for navigation bars);
Controls the height of the inline element;
Set the background color of a block element to the width of the text without having to set a width

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.