CSS design: how to use the web border boader

Source: Internet
Author: User

Instance 1:

CSS:
P {padding: 15px; border: 1px solid black ;}
H5 {padding: 0px; border: 1px solid red ;}
XHTML:
<P> This is a paragraph that has a padding of 15 pixels on every side: top, right, bottom, and left. </p>
<H5> This header has no padding, which places the text right against the border! </H5>

 

Example 2:

CSS:
P {padding: 2%; border: 1px solid black ;}
H5 {padding: 0px; border: 1px solid red ;}
XHTML:
<P> This is a paragraph that has a padding of 5 pixels on every side: left, top, right, and bottom. </p>
<H5> This header has no padding. It is only spaced away from the paragraph because the paragraph has a padding of 5 pixels! </H5>

 

Example 3:

CSS:
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;
}
XHTML:
<P> This paragraph had one padding specified (left), using directional declaration. </p>
<H5> This header had each padding specified separately, using directional declaration.

 

Example 4:

CSS:
P {
Padding: 5px 15px;
Border: 1px solid black;
} 
H5 {
Padding: 0px 5px 10px 3px;
Border: 1px solid red;
}
XHTML:
<P> This paragraph has a top and bottom padding of 5 pixels and a right and left padding of 15 pixels. </p>
<H5> This header has a top padding of 0 pixels, a right padding of 5 pixels, a bottom padding of 10 pixels, and a left padding of 3 pixels.

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.