Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to use the margin-bottom property in CSS

Shulou Source: shulou.com Published: 2022-05-31 13:19:45 10月29日 Update

Today Xiaobian to share with you how to use the CSS margin-bottom attribute related knowledge points, detailed content, clear logic, I believe most people still know too much about this knowledge, so share this article for everyone to refer to, I hope you read this article after harvest, let's learn about it together.

CSS margin-bottom property

defined

The margin-bottom property sets the lower margin of the element.

Note: Negative values are allowed.

Inheritance: NO

JavaScript syntax

CSS properties can also be changed dynamically via a JavaScript snippet.

Script syntax:

object.style.marginBottom="32px" Example All four margins are 10px:

h2{ margin-bottom:10px; } h2{ margin-bottom:-20px; }

Top and bottom margins are 10px, left and right margins are 2% of parent width:

h2{margin:10px2%;} Top margin is 10px, left and right margins are 2% of parent width, bottom margin is-10px:

h2{margin:10px2%-10px;} Top margin is 10px, right margin is 2% of parent width, bottom margin is-10px, and left margin is set by browser:

h2{margin:10px2%-10pxauto;}

possible values

The above is "CSS margin-bottom attribute how to use" all the content of this article, thank you for reading! I believe everyone has a great harvest after reading this article. Xiaobian will update different knowledge for everyone every day. If you want to learn more knowledge, please pay attention to the industry information channel.

Tags: Attributes elements knowledge articles right width bottom content grammar different large examples dynamic most that is more comments browsers knowledge points inheritance Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Apple Shulou Information OPPO Reno Docker