This code seems to have different effects in every browser.
.container {
display: inline-block;
border: 1px solid black;
padding-top: 5px;
padding-bottom: 5px;
}
.box {
display: table;
width: 10px;
height: 10px;
background-color: red;
border: 5px solid blue;
}
<div class="container">
<div class="box"></div>
</div>
Run codeIn Chrome 43.0, a table is not limited to a container:

In Safari 5.1, the border completely overlaps the table, since it interprets the width as the width of the border:

In Firefox 38.0 and Internet Explorer 11.0, the table displays correctly:

Ideally, all browsers behave like Firefox / Internet Explorer.
Using box-sizing: border-boxand increasing the width .boxto include the width of the border, all browsers display the version of Firefox / Internet Explorer, but assuming the border width is unknown, is there a way to make all major browsers display the model according to Firefox / Internet Explorer (without using JavaScript)?
:
table-layout: fixed .box.border-collapse: separate .boxbox-sizing: content-box .box<table> display: table ( Chrome , Safari, .)
, , Chrome : border-box : , . >
:
, . , <div> display: table, , ( ) . div . div , . - , , div .