css 边框效果参数

今天来看看利用 css 制作边框效果的参数

1 . css 代码:

  1. p {padding: 15px; border: 1px solid black; } 
  2. h5{padding: 0px; border: 1px solid red;}


网页内容:

  1. <p>This is a paragraph that has a padding of 15 pixels on every side: top, right, bottom, and left.</p>
  2. <h5>This header has no padding, which places the text right against the border!</h5>

显示效果:
1.gif

2 . css 代码:

  1. p {padding: 2%; border: 1px solid black; }
  2. h5{padding: 0px; border: 1px solid red;}

网页内容:

  1. <p>This is a paragraph that has a padding of 5 pixels on every side: left, top, right, and bottom.</p>
  2. <h5>This header has no padding. It is only spaced away from the paragraph because the paragraph has a padding of 5 pixels!</h5>

显示效果:
11.gif

3 . css 代码:

  1. p { padding-left: 5px; border: 1px solid black; }
  2. h5{
  3.     padding-top: 0px;
  4.     padding-right: 2px;
  5.     padding-bottom: 13px;
  6.     padding-left: 21px;
  7.     border: 1px solid red;
  8. }

网页内容:

  1. <p>This paragraph had one padding specified(left), using directional declaration.</p>
  2. <h5>This header had each padding specified separately, using directional declaration.</h5>

显示效果:
12.gif

4 . css 代码:

  1. p {
  2.     padding: 5px 15px;
  3.     border: 1px solid black;
  4. h5{
  5.     padding: 0px 5px 10px 3px;
  6.     border: 1px solid red;
  7. }

网页内容:

  1. <p>This paragraph has a top and bottom padding of 5 pixels and a right and left padding of 15 pixels.</p>
  2. <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.</h5>

显示效果:
13.gif

作者:peterzsk
本文永久链接:http://zsk.akaka.com.cn/2008/05/css-padding/
采用CC创作共用协议,转载需保留以上信息并<署名、非商业和保持一致>。

如果您喜欢我的文章,可以订阅我的 谢谢。
  • 看过本篇的朋友,还看过:

  • 1 Response to “css 边框效果参数”


    1. […] css 边框效果参数 (0) […]

    Leave a Reply