My HTML file contains the following code:
<html lang="en" class=""><head>
<meta charset="UTF-8">
<title>CodePen Demo</title>
<meta name="robots" content="noindex">
<link rel="shortcut icon" type="image/x-icon" href="https://static.codepen.io/assets/favicon/favicon-aec34940fbc1a6e787974dcd360f2c6b63348d4b1f4e06c77743096d55480f33.ico">
<link rel="mask-icon" type="" href="https://static.codepen.io/assets/favicon/logo-pin-8f3771b1072e3c38bd662872f6b673a722f4b3ca2421637d5596661b4e2132cc.svg" color="#111">
<link rel="canonical" href="https://codepen.io/hardkoded/pen/VwjvWBm">
... (skipping some code for brevity) ...
... (skipping some code for brevity) ...
</script>
</body></html>
This is actually a modified Tic Tac Toe game from this CodePen link: https://codepen.io/sophiebits/pen/qNOZOP. I made some changes to it.
When inspecting one of the squares in Chrome, I noticed that the computed CSS box model showed a content width of 32px
, even though I set the square's width
to be 34px
in the CSS. Shouldn't the computed width match what was specified in the CSS?
I'm aware that the default value of box-sizing
is content-box
, meaning the width
property should exclude any border
or padding
. So why is there discrepancy between the specified width and the computed width of the square?