CSS - 屏幕尺寸减去常量

标签 css

<分区>

是否有可能以某种方式将元素的大小计算为基本的数学表达式? 例如:

.wideColumn{max-width:100%-20em;} /*not working*/

最佳答案

这可以使用 LESS 来完成或 jQuery .但不幸的是,它不能用纯 CSS 来完成。

但是,使用纯 CSS 可以解决此问题。例如:

.wideColumn {
    max-width: 100%;
    margin-right: 10em;
    margin-left: 10em;
}

当然,这个例子可能不适用于您的代码。但还有许多其他解决方法。

关于CSS - 屏幕尺寸减去常量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14772249/

上一篇:javascript - jQuery focus() 页面滚动长度

下一篇:iphone - 如何删除仅出现在 iphone 浏览器中的小空间

相关文章:

css - Chrome : Having an HTML5 video position: fixed or absolute causes all background-attachment: fixed to break

jquery - 互联网浏览器 :hover state becomes sticky when the target DOM element is moved in the DOM

html - <div> 中的 3 列

css - 防止标题背景图像在较大的视口(viewport)上变窄

css - 从背景中剪下的透明文本

javascript - 在jquery中动态创建一个选择器并使用 'this'

html - 具有嵌套元素的 CSS 粘性位置

css - 初学CSS定位( float )

html - 将多个 div 在其父 div 中垂直居中

html - 使用散列或 url 片段时设置事件链接样式?