Last active
April 25, 2017 16:29
-
-
Save ehzhang/fd6cf7948dd3be82675f518ba0cb0dcd to your computer and use it in GitHub Desktop.
prince box-sizing padding/border bug.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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