Possible Duplicate:
Is css box-shadow part of element's box model?
Does a css border-shadow property add to an element's size or is it added after and not effect other elements?
So say my div width is 100px, margin 10px, border 1px, padding 5px, box-shadow 2px, is the total width of the element 136px (inclusive of all the above) or 132px (just the first four).
Effects like box-shadow don't affect the size or the spacing.
By default in the CSS box model, the width and height you assign to an element is applied only to the element's content box. If the element has any border or padding, this is then added to the width and height to arrive at the size of the box that's rendered on the screen.
To avoid the width or height getting increased or decreased when using CSS properties like margin , padding , etc, we can use the CSS property called box-sizing and set its value to border-box on the element in CSS.
The box-shadow property enables you to cast a drop shadow from the frame of almost any element. If a border-radius is specified on the element with a box shadow, the box shadow takes on the same rounded corners.
no, the shadow doesn't affect the elements size (just like an outline; read more about this here). To answer the example: your div is 132px wide.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With