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

How to apply CSS outer margin

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

Share

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

The main content of this article is to explain "how to apply CSS margins". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to apply CSS margins".

If there is an empty element, it has an outer margin, but no borders or additions. In such cases, the upper and lower margins meet together, and they are separated:

If this outer margin encounters the outer margin of another element, it will also merge:

This is why a series of paragraph elements take up particularly little space because all their outer margins are merged together to form a small outer margin.

At first glance, the outer margin merger may seem a little unique, but in practice, it is intentional. Take a sample text page consisting of several paragraphs as an example. The space below the first paragraph is equal to the top margin of the paragraph. If there is no margin merge, the outer margin between all subsequent paragraphs will be the sum of the adjacent top and bottom margins. This means that the space between paragraphs is twice as large as that at the top of the page. If the outer margin separation occurs, the upper outer margin and the lower outer margin between paragraphs will be merged together, and the intervals everywhere will be divergent.

At this point, I believe you have a deeper understanding of "how to apply CSS margins". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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