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 set the CSS div spacing

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

Share

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

This article mainly introduces the relevant knowledge of "how to set CSS div spacing". The editor shows you the operation process through an actual case. The operation method is simple, fast and practical. I hope this article "how to set CSS div spacing" can help you solve the problem.

First, eliminate the isolation distance of the concave and convex mechanism.

Distance between DIV

Let the distance between the two high and low DIV blocks be zero. Usually, the expert will not think about initializing the CSS attribute when producing the DIV CSS page, so that the CSS attribute acquiesced by each tag attribute will result in dislocation, compatibility and other problems.

For example, there is a certain distance between the two box DIV blocks organized high and low.

II. Planning method for eliminating DIV spacing

Configure each attribute parameter of the DIV tag to 0 in CSS

Div {margin:0;border:0;padding:0;}

Here, the equipment is configured with the DIV tag CSS attribute, which is commensurate with the initialization of the DIV tag CSS attribute, where the equipment equipment margin outer margin is set to 0; the border border attribute is 0 and the inner whitespace is also 0; this is equivalent to initializing the DIV box with an attribute partition of 0, which means that there may not be an unnecessary isolation distance between the DIV directly.

Just recommend that when making a repulsive DIV CSS, it is best to initialize the web page CSS attribute and often apply the web page tag.

Configure the spacing between DIV boxes

Apply the CSS pattern word to margin (you can enter the CSS margin tutorial to be familiar with the detailed application).

1. Set the distance between the top and bottom of the object.

. CSS5-a {margin:10px 0}

Configure the high and bottom spacing of the "CSS5-a" object to 10px and manipulate to 0

2. Set the object control partition

. CSS5-b {margin:0 8px}

Set the distance between the top and bottom of the equipment "CSS5-b" object to 0 and manipulate it to 8px.

3. Set the distance between the DIV box and the top of the equipment

. CSS5-c {margin-top:10px}

Configure the adjacent spacing between the "CSS5-c" object and the top to be 10px

4. Set the DIV box to be separated from the bottom.

. CSS5-d {margin-bottom:10px}

Set the distance between the "CSS5-d" object and the lower part of the equipment to 10px.

5. Set the distance between the DIV box and the left side

. CSS5-e {margin-left:9px}

Set the adjacent distance between the "CSS5-e" object and the left side to 9px

6. Configure the box to be separated from the right side

. CSS5-f {margin-right:12px}

Set the adjacent spacing between the "CSS5-f" object and the right side to 12px

This is the end of the content about "how to set the CSS div spacing". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

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: 280

*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