Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
prince box-sizing padding/border bug.
<html>
<head>
<style>
* {
box-sizing: border-box;
}
.item {
width: 20px;
height: 20px;
position: relative;
}
.border-workaround {
position: absolute;
top: 0;
left: 0;
border: 4px solid black;
width: 20px;
height: 20px;
}
.container {
display: inline-block;
padding-left: 20px;
padding-right: 20px;
border: 1px solid red;
}
</style>
</head>
<body>
<div class="container">
<div class="item">
<div class="border-workaround">
</div>
</div>
</div>
</body>
</html>
<html>
<head>
<style>
* {
box-sizing: border-box;
}
.item {
width: 20px;
height: 20px;
border: 5px solid black;
}
.container {
display: inline-block;
padding-left: 20px;
padding-right: 20px;
border: 1px solid red;
}
</style>
</head>
<body>
<div class="container">
<div class="item"></div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment