Comprehensive guide to modern HTML and CSS development.
The Box Model is arguably the most important concept in CSS. Every element on a webpage is a rectangular box. The box consists of four layers (from inside to outside):
By default, adding padding and borders makes the element wider than the width you set. By setting box-sizing: border-box;, padding and borders are included in the element's total width and height. This is a standard practice on modern websites.
Edit the code below and click Run to see the result live.