HTML & CSS interview questions
Show answer
Every element is a box: content, padding, border and margin. With the default
box-sizing: content-box,widthapplies only to content, so padding and border make the box wider.box-sizing: border-boxincludes padding and border inwidth, which makes layouts predictable — most projects set it globally.Show answer
Flexbox lays items out in one direction (a row or a column) and is ideal for toolbars, nav bars and centring. Grid controls rows and columns together and suits page layouts, card galleries and anything aligned on two axes. They combine well: a Grid page layout with Flexbox inside components.