开发者

what is the difference between padding and margin?

开发者 https://www.devze.com 2023-01-23 23:29 出处:网络
what is the differe开发者_Go百科nce between padding and margin? both do the same thing. This image is the better explanationWrong!

what is the differe开发者_Go百科nce between padding and margin?

both do the same thing.


what is the difference between padding and margin?

This image is the better explanation


Wrong!

Padding is internal padding for items inside elements.

Margin is the external padding for the positioning of said element.

[edit] link for goodness: http://webdesign.about.com/od/faqsandhelp/f/bl_faq5_7a.htm


  • Padding defines the space between the border and the content.
  • Margin defines the space between other outside elements and the broder.

what is the difference between padding and margin?


(source: xhtml.com)

Of course if you don't specify a border, it looks the same.


Margin is distance outside the container's border. Padding is the distance inside of it.

Check out the box model for CSS: http://www.w3.org/TR/CSS2/box.html


Not quite.

Padding adds space between the margins of the control and the inner content.

Margins adds space between the margisn of the control and the outer container.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号