首頁  >  文章  >  web前端  >  css margin-bottom屬性怎麼用

css margin-bottom屬性怎麼用

青灯夜游
青灯夜游原創
2019-05-29 11:49:174142瀏覽

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>

效果圖:

css margin-bottom屬性怎麼用

以上是css margin-bottom屬性怎麼用的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn