Detailed description of CSS margin usage and cssmargin usage

Source: Internet
Author: User

Detailed description of CSS margin usage and cssmargin usage

Detailed usage of CSS margin:
Suggestion: writing code as much as possible can effectively improve learning efficiency and depth.
The margin attribute is frequently used on webpages. Therefore, the usage of this attribute is described in detail here.
This attribute defines the outer margin of an object, also known as the Outer padding. The so-called outer margin is the blank area around the outer border. You can separately define the outer margin of one of the upper and lower sides. The code example is as follows:
Instance 1:
When the sub-div has no margin:

<! DOCTYPE html> 

Example 2:
Set sub-div after left margin:

<! DOCTYPE html> 

The above Code sets the left margin of the sub-div, so that you can clearly understand the meaning of the outer margin.
Of course, we can use margin-right, margin-top, and margin-bottom to set the margins of their respective orientations. Although the margins are clear through the outer attributes of their respective orientations, they are slightly redundant. Therefore, you can use the margin attribute to set the margins of multiple orientations at one time. The code example is as follows:

<! DOCTYPE html> 

In the above Code, four margins of an object are set at one time by using the margin attribute.
The following are the features of the value of the margin attribute:
If all four parameter values are provided, the top, right, bottom, and left parameters are added to the four sides.
If only one is provided, all the four sides are used.
If two are provided, the first is used for top and bottom, and the second is used for left and right.
If three are provided, the first is used for the top, the second is used for the left and right, and the third is used for the bottom.

The original address is: http://www.softwhy.com/forum.php? Mod = viewthread & tid = 4657.

For more information, see: http://www.softwhy.com/divcss/

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.