CSS display style, Padding,margin

Source: Internet
Author: User

1. Block-level labels become inline labels

<! DOCTYPE html>

Effect:

2. Inline labels become block-level labels

<! DOCTYPE html>

Operation Result:

3. Display:none; Let the label disappear. display:block/inline; label recovery.

Display:inline;

Display:block;

Display:inline-block; Both attributes (with inline, the default number of their own how much, with blocks, you can set the height, width and so on. )

Inline Tags: Unable to set height, width, screenwriter, padding, margin

Block-level Tags: can be set height, width, screenwriter, padding, margin. The default is 100% of the father's label

<! DOCTYPE html>

Operation Result:

4.padding: Inner margin padding-top10px,

Margin: The blue part of the margin margin-top:10px, (for the div inside). The size of the div itself has not changed. It's just that the distance between him and his father is getting bigger.

Pading: The inner margin is also relative to the internal div. (Original meaning: filler)

Another use for 5.margin: <body style= "margin:0 auto;" >

By default, there are margins on both sides of the HTML. The outer margin was removed. Starting from the corner.

<div style= "width:980px; margin:0 Auto ">

Display style of CSS, Padding,margin

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.