A brief discussion on CSS blocking merging and other effects

A brief discussion on CSS blocking merging and other effects

Non-orthogonal margins

When margin is used, it will cause merging

The following properties will prevent margin merging:

border

display: table

display: flex

The above content is the result of the detailed explanation below

Blocking merger [Detailed explanation]

/* CSS */

    .box{
        border:1px solid red;
        height: 100px;
        margin: 10px; /* Note: this is 10 pixels! */
    }
<!-- HTML -->

<div class="box"></div>
<div class="box"></div>
<div class="box"></div>

This is what it looks like in the browser:

According to the rational number margin, the spacing between the top and bottom of the div should be 20px

Solution 1:

<!-- HTML -->
<!-- css unchanged -->

<div class="box"></div>
<div style="border: 1px solid blue"></div> <!-- Newly added -->
<div class="box"></div>
<div style="border: 0.1px solid blue"></div> <!-- Newly added -->
<div class="box"></div>
<div class="box"></div>

This is what it looks like in the browser:

<!-- HTML -->
<!-- css unchanged -->

<!-- HTML -->
<div class="box"></div>
<div style="display: table"></div>
<div class="box"></div>
<div style="display: flex"></div>
<div class="box"></div>
<div class="box"></div>
<!-- display:block / inline will not block merging, only table flex can -->

This is what it looks like in the browser:

Other Impacts

display will affect the small dots of ul li

position: absolute will affect display: inline

position: fixed will affect transform

float affects inline

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

<<:  Detailed explanation of creating, calling and managing MySQL stored procedures

>>:  Usage of the target attribute of the html tag a

Recommend

React Fragment Introduction and Detailed Usage

Table of contents Preface Motivation for Fragment...

Five solutions to cross-browser problems (summary)

Brief review: Browser compatibility issues are of...

Detailed explanation of nginx shared memory mechanism

Nginx's shared memory is one of the main reas...

Detailed explanation of the pitfalls of mixing npm and cnpm

Table of contents cause reason Introduction to NP...

Innodb system table space maintenance method

Environmental Description: There is a running MyS...

How to gracefully and safely shut down the MySQL process

Preface This article analyzes the process of shut...

DOCTYPE element detailed explanation complete version

1. Overview This article systematically explains ...

Html+css to achieve pure text and buttons with icons

This article summarizes the implementation method...

How to limit the input box to only input pure numbers in HTML

Limit input box to only pure numbers 1、onkeyup = ...

Graphic tutorial on installing tomcat8 on centos7.X Linux system

1. Create the tomcat installation path mkdir /usr...

Detailed explanation of Linux rpm and yum commands and usage

RPM package management A packaging and installati...