margin-bottom指的是什么意思

margin-bottom指的是什么意思

这篇文章主要介绍margin-bottom指的是什么意思,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!

margin-bottom是CSS中的一个属性,用于设置元素的下外边距,所有主流浏览器都支持 margin-bottom 属性。下面我们就来简单看一下margin-bottom属性的用法。

margin-bottom属性的语法如下:

margin-bottom:value

value可能的值:

auto:浏览器计算下外边距。

length:规定以具体单位计的下外边距值,比如像素、厘米等。默认值是 0px。

% :规定基于父元素的宽度的百分比的下外边距。

inherit: 规定应该从父元素继承下外边距。

我们来看一下margin-bottom的代码示例

<html>
<head>
<style type="text/css">
p.bottommargin {margin-bottom: 2cm}
</style>
</head>

<body>
<p>这个段落没有指定外边距。</p>
<p class="bottommargin">这个段落带有指定的下外边距。</p>
<p>这个段落没有指定外边距。</p>
</body>

</html>

运行结果如下:

margin-bottom指的是什么意思

以上是“margin-bottom指的是什么意思”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注行业资讯频道!