Get to know MDN better
此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。
CSS 的 margin-bottom 属性用于设置元素的底部外边距,允许设置负数值。一个正数值将让它相对于正常流与邻近块更远,而负数值将使得更近。
该属性对于*不可替代 (non-replaced 元素在规范中有概念,请自行搜索)*的行级元素没有效果,比如: <tt> 或者 <span>.
| 0 |
| all elements, except elements with table display types other than table-caption, table and inline-table. It also applies to ::first-letter. |
| 否 |
| refer to the width of the containing block |
| the percentage as specified or the absolute length |
| a length |
定义了一个确定的宽度值,参见 <length> 以了解更多可能的值。
<percentage><percentage> 始终与包含该元素的容器宽度有关。
auto由浏览器自己选择一个合适的值。参见 margin。
用于设置 div 的 margin-bottom 和 height 的 CSS 代码
为了使 margin 产生的影响更明显,添加了一些 container 和 div 的样式定义
| CSS Box Model Module Level 3 # margin-physical |
启用 JavaScript 以查看此浏览器兼容性表。