정리하면,
태그 전체 크기 = content + border + padding + margin
content 크기 = content
다음과 같은 요소가 주어졌을 때, width와 height의 크기는 아래와 같다.
<div
style="
width: 100px;
height: 100px;
box-sizing: content-box;
border: 10px black solid;
"
>
content
</div>
정리하면,
태그 전체 width, height = 10px + 100px + 10px = 120px
content width, height = 100px
정리하면,
태그 전체 크기 = content + border + padding + margin
content 크기 = 태그 전체 크기 – border – padding – margin
<div
style="
width: 100px;
height: 100px;
box-sizing: border-box;
border: 10px black solid;
"
>
content
</div>
정리하면,
태그 전체 width, height = 10px + 80px + 10px = 100px
content width, height = 100px – 10px – 10px = 80px
https://dasima.xyz/css-box-sizing-content-box-vs-border-box/