Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the common uses of margin in css

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report