Detailed description of CSS padding usage and csspadding
Detailed usage of CSS padding:
Suggestion: writing code as much as possible can effectively improve learning efficiency and depth.
The padding attribute is frequently used on webpages. Therefore, the usage of this attribute is described in detail here.
This attribute is used to define the padding or padding of an element. The so-called padding is the blank area between the content of an element and the inside of the element. You can separately define the padding of one of the upper and lower sides.
Code example:
Instance 1:
When the padding of the parent div is not set:
<! DOCTYPE html>
Example 2:
Set the parent div padding:
<! DOCTYPE html>
The above Code sets the left padding of the parent div.
Of course, we can use padding-right, padding-top, and padding-bottom to set the margins of their respective orientations. Although the margins are clear through the outer attributes of their respective orientations, they are also slightly redundant. Therefore, you can use the padding 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 the object are set at one time by using the padding attribute.
The following describes the features of the padding attribute values:
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 = 4655.
For more information, see: http://www.softwhy.com/divcss/