首页  >  文章  >  web前端  >  css margin-bottom属性怎么用

css margin-bottom属性怎么用

青灯夜游
青灯夜游原创
2019-05-29 11:49:174141浏览

css margin-bottom属性用于设置元素的下外边距,允许使用负值。所有主流浏览器都支持 margin-bottom 属性。

css margin-bottom属性怎么用

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>

效果图:

1.jpg

以上是css margin-bottom属性怎么用的详细内容。更多信息请关注PHP中文网其他相关文章!

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn