CSS padding, csspadding

Source: Internet
Author: User

CSS padding, csspadding
CSS padding is used to control the inner spacing of the div table. Let's talk about the padding instance.

CSS padding

With CSS filling, you will be able to change the various HTML elements (paragraphs, tables, etc.) that appear in the default gap ). But first, let us trust the filling of our understanding definition. A filled space is within the boundary and content of an integral part.

See the visual representation in the following example. Note: The boundary has been obvious. For each element, you may be more likely to see the effect filling.

P {padding: 15px; border: 1px solid black ;}
H5 {padding: 0px; border: 1px solid red ;}

 

There are several methods to define the CSS fill attribute. We will show you all possible ways to let you know that the method is the best.

CSS filling:
As you can see in the above example, filling can be done in a unified factor. Specifying a value will create a unified filling of all parties: Top, right, bottom, left. In addition to the exact value, you can also define the percentage used for filling.

P {padding: 2%; border: 1px solid black ;}
H5 {padding: 0px; border: 1px solid red ;}

CSS fill: Fill (Direction ):
Each HTML element actually has four different paddings: Top, right, bottom, and exit. It is possible to determine that these individual paddings only add the fill attribute of the direction suffix. For example, fill (direction ). Only one definite direction will leave the other 3. The default paddings will remain unchanged.

P {padding-left: 5px; border: 1px solid black ;}
H5 {
Padding-top: 0px;
Padding-right: 2px;
Padding-bottom: 13px;
Padding-left: 21px;
Border: 1px solid red;
}

CSS filling: 2 & 4 values
The four fill values can be declared as two or four values at a time. When only two values are used, the first will determine the top and bottom of the filling, and the second will determine the left and right of the filling.

When the four value Filling specifications are used, the corresponding direction is: Top, right, bottom, left. To help you remember the commands, remember that it starts at the top and moves clockwise until it reaches the left. The following example shows partial (2) and complete (4) filling. From: http://www.111cn.net/cssdiv/56/f1cad8ffb23e3e668d3d62cff5c4f368.htm

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.