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/