时间:2021-07-01 10:21:17 帮助过:84人阅读

css margin-bottom属性怎么用?
margin-bottom属性设置元素的下外边距。
可设置的属性值:
● auto:浏览器计算下外边距。
● length:规定以具体单位计的下外边距值,比如像素、厘米等。默认值是 0px。
● %:规定基于父元素的宽度的百分比的下外边距。
● inherit:规定应该从父元素继承下外边距。
说明:该属性允许使用负值。
注释:所有主流浏览器都支持 margin-bottom 属性。
css margin-bottom属性 示例
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
p.bottommargin {margin-bottom: 2cm}
</style>
</head>
<body>
<p>这个段落没有指定外边距。</p>
<p class="bottommargin">这个段落设置了2厘米的底边距。</p>
<p>这个段落没有指定外边距。</p>
<p>这个段落没有指定外边距。</p>
</body>
</html>效果图:

以上就是css margin-bottom属性怎么用的详细内容,更多请关注Gxl网其它相关文章!