Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the common uses of margin in css

Shulou Source: shulou.com Published: 2022-06-01 04:05:56 10月02日 Update

Editor to share with you what are the common uses of margin in css, I believe most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's learn about it!

Margin

1 、 margin-left

Set the left outer margin of the object

Margin-left:10px;-sets the left margin 10px

2 、 margin-right

Set the right outer margin of the equipment installation object

Margin-right:20px;-set the right outer margin of the equipment 20px

3 、 margin-top

Set the outer margin of the equipment decoration object

Margin-top:15px-set the top margin 15px

4 、 margin-bottom

Configure the bottom margin of the object

Margin-bottom:30px-set the outer margin 30px

The things in the above counterweight div,css selector need to be equipped with outer margins.

The following are common abbreviations used

5 、 margin:0

The top, left, bottom and right spacing of the configuration object margin are all 0

6 、 margin:0 auto

Configure the object with a high and low margin of 0 and dominate automatically. This attribute is often centered on the level of the object, for example, div is centered, and equipment margin:0 auto is set for div. At the same time, do not configure float, you can make this div center.

7 、 margin:10px 20px

Set the equipment installation object high and low outer margin 10px, left and right outer margin 20px

8 、 margin:10px 15px 20px 25px

Set the upper outer margin 10px, right outer margin 15px, lower outer margin 20px, left outer margin 25px of the object

9 、 margin:10px 20px 30px

Configure the upper outer margin 10px, the dominant outer margin 20px, and the lower outer margin 30px

10 、 margin:10px;margin-left:0

If the object is configured with margin:10px;margin-left:0 at the same time, it means that the top, bottom, left and right outer margins of the object are configured first, and then 0 is configured on the left. The ending is equivalent to 10px on the top, bottom and right of the object, and 0 on the left.

Point 10 belongs to wrist applications.

The above is all the content of the article "what are the common uses of margin in css". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Objects configurations furnishings common articles content at the same time odd not much things representatives most attributes commonly used wrist more standards knowledge acronyms industry Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Shulou Information vpn MySQL Huawei