Detailed description of CSS padding usage and csspadding

Source: Internet
Author: User

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/

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.