The padding padding property in CSS describes "examples in detail"

Source: Internet
Author: User
When we are in front-end page layout, CSS internal and external margin properties of the role is extremely important, only the full use of CSS padding and margin properties are CSS padding and margin style attributes to complete the design of good-looking front-end page. So before I wrote "What are the CSS margin properties?" What are the uses? "Has given you a detailed description of CSS margin properties of the use of the specific method. This article will continue to introduce to you css padding padding propertiesThe specific use of the method!

Below we have detailed code examples for everyone to explain.

Here is a section of the CSS padding property using the sample code as follows:

<! DOCTYPE html>

The above code effects are as follows:


First we need to know that padding represents the distance between an element and its bounding rectangle. Then we look at the div block P1, we set the text in the padding 10px style attributes, also let the text and the four-sided red border distance is increased by 10 pixels. Then we add padding:20 30px to P2, the style attribute, which indicates that the upper and lower margins of the text segment are 20px, and the left and right margins are 30px.

We continue to see the P3 added in the padding:10px 5px 15px 20px, the style of the property, here is the text of the upper padding is 10px, the right padding is 5px, the bottom padding is 15px, the left padding is 20px.

Here the upper and lower left and right margin settings, can also be taken out to write, such as Padding-top, Padding-left, Padding-bottom, Padding-right.

Note: CSS style padding padding can not set negative values!

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.