CSS边框阴影是否会增加元素的大小 [英] Does css border-shadow add to an element's size

查看:40
本文介绍了CSS边框阴影是否会增加元素的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
css盒阴影是否是元素盒模型的一部分?

css的border-shadow属性会增加元素的大小吗,还是在之后添加而不影响其他元素?

Does a css border-shadow property add to an element's size or is it added after and not effect other elements?

所以说我的div宽度是元素136px(包括上述所有元素)或132px(仅前四个)的总宽度,即div宽度为100px,边距为10px,边框为1px,填充阴影为5px,框阴影为2px.

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).

推荐答案

不,阴影不会影响元素的大小(就像轮廓一样;

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.

这篇关于CSS边框阴影是否会增加元素的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆