css - box-sizing vs. inset box-shadow -
i wondering best way add border elements without extending dimensions.
as far know, there 2 ways achieve it: box-sizing:border-box;
, inset box-shadow
. 1 wise use , why?
well box-shadow
isn't border, it's shadow, question pretty answers itself.
if wish add border without increasing element's dimensions, you'd use box-sizing: border-box
, it's designed for.
from the specification:
the specified width , height (and respective min/max properties) on element determine border box of element. is, padding or border specified on element laid out , drawn inside specified width , height.
do note, however, firefox supports prefixed version: -moz-box-sizing: ...
.
Comments
Post a Comment