CSS宽度减法

如何减去CSS中的宽度?

例如:

width = 100% – 10px

我不是在说填充或边距。

解决方法

现在 calc解决方案将是:
width: calc(100% - 10px);

Calc可以使用加法,减法,乘法,除法。

附加说明:

Note: The + and – operators must always be surrounded by whitespace. The operand of calc(50% -8px) for instance will be parsed as a percentage followed by a negative length,an invalid expression,while the operand of calc(50% – 8px) is a percentage followed by a minus sign and a length. Even further,calc(8px + -50%) is treated as a length followed by a plus sign and a negative percentage. The * and / operators do not require whitespace,but adding it for consistency is allowed,and recommended.

相关文章

Css3如何实现鼠标移上变长特效?(图文+视频)
css3怎么实现鼠标悬停图片时缓慢变大效果?(图文+视频)
jquery如何实现点击网页回到顶部效果?(图文+视频)
css3边框阴影效果怎么做?(图文+视频)
css怎么实现圆角边框和圆形效果?(图文+视频教程)
Css3如何实现旋转移动动画特效