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

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3ddca-2c3ad.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3ddca-2c3ad.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?