Under a simple two-column layout, the width reserved for another column needs to be larger than the actual width

html structure:

<div id="left"></div>
<div id="right"></div>

css Code:

* {
    box-sizing: border-box;
}
-sharpleft, -sharpright {
    display: inline-block;
    vertical-align: top;
}
-sharpleft {
    width: calc(100% - 205px); 
    /* don"t know why additional 5px? */
}
-sharpright {
    width: 200px;
}

demo: https://codepen.io/anon/pen/N.

A simple two-column layout that uses calc () to dynamically calculate the width of the left column to reserve space for the right column.

according to my understanding, -sharpright is 200px, and there is nothing else in the middle. The left column width should be calc , but the actual test shows that the right column will be squeezed to the next row, and at least calc (100%-205px) is needed to ensure that the two columns are at the same level. Where is the extra 5px occupied?

in both chrome and IE11 tests

Mar.28,2021

<style>
    body{
        font-size: 0px;
    }
    * {
        box-sizing: border-box;
        padding: 0;
        margin: 0;
    }
    -sharpleft, -sharpright {
        display: inline-block;
        vertical-align: top;
        font-size: 14px;
    }
    -sharpleft {
        width: calc(100% - 200px);
        /* don't know why additional 5px? */
    }
    -sharpright {
        width: 200px;
    }
</style>
</head>
<body>
    <div id="left">1</div>
    <div id="right">2</div>
</body>

Block-level elements have inner and outer margins. If you don't transfer it manually. He will exist.

It would be nice to tune

as it was written upstairs.

you can also refer to initialize css , minireset.css

Menu