边距和填充之间的区别? [英] Difference between margin and padding?

查看:37
本文介绍了边距和填充之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

CSS 中的 ma​​rginpadding 到底有什么区别?它似乎真的没有多大用处.你能给我举个例子说明差异在哪里(以及为什么了解差异很重要)?

What exactly is the difference between margin and padding in CSS? It really doesn't seem to serve much purpose. Could you give me an example of where the differences lie (and why it is important to know the difference)?

推荐答案

padding 是内容和border之间的空间,而margin> 是边界外的空间.这是我从 Google 快速搜索中找到的一张图片,它说明了这个想法.

padding is the space between the content and the border, whereas margin is the space outside the border. Here's an image I found from a quick Google search, that illustrates this idea.

这篇关于边距和填充之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆