- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 Visual Studio 及其捆绑功能来缩小 CSS 文件。
当它发现以下指令时返回错误:
.ui.card .image > .ui.ribbon.label,
.ui.image > .ui.ribbon.label {
left: calc(--0.05rem - 1.2em);
}
这就是为什么我想知道这是否是一个有效的 CSS 语法,如果我去掉那个“额外的”减号,一切都会好起来的。
最佳答案
calc(--x - y)
有效的 CSS 语法? The --
prefix is used to define custom properties:
A custom property is any property whose name starts with two dashes (U+002D HYPHEN-MINUS), like
--foo
. The<custom-property-name>
production corresponds to this: it’s defined as any valid identifier that starts with two dashes, except--
itself, which is reserved for future use by CSS. Custom properties are solely for use by authors and users; CSS will never give them a meaning beyond what is presented here.
使用自定义属性的示例:
:root {
--back-color: red;
}
p {
background: var(--back-color);
}
<p>Hello StackOverflow</p>
所以在你的情况下(计算 -1 * -1 = 1
) --
无效。
semantic.css文件是 LESS 脚本 ( semantic.less ) 的结果。在以下屏幕截图中,您可以看到 --
的来源.所以它看起来像是错误或意外行为:
以下代码的构建类似于 semantic.less 代码:
@test: -0.05em;
.test {
margin-left: calc(-@test);
}
编译为以下 CSS(再次使用 --
):
.test {
margin-left: calc(--0.05em);
}
相同的代码,但不使用 calc
功能:
@test: -0.05em;
.test {
margin-left: -@test;
}
编译为以下 CSS:
.test {
margin-left: 0.05em;
}
如何修复(可能的修复)?
@test: -0.05em;
.test {
margin-left: calc(@test * -1);
}
编译为以下 CSS:
.test {
margin-left: calc(-0.05em * -1);
}
在 LESS 早期的 3.0 中,数学是在 calc
中执行的功能。所以 calc(-@test)
compiles to calc(0.05em)
.但是自从 LESS 3.0 以来,calc
中没有执行任何数学运算。所以 calc(-@test)
compiles to calc(--0.05em)
:
Essentially, the calc() bug was recently fixed and no math is performed within calc(). But functions within calc() will still perform math on their arguments (unless the inner function is also calc).
source: https://github.com/less/less.js/issues/3221#issuecomment-398610371
关于css - calc(--x - y) 是有效的 CSS 语法吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55168760/
我想过滤掉特定列上具有特定颜色的行。我尝试几乎到处搜索但找不到答案。希望大家给点好的建议,谢谢。 最佳答案 据我所知,目前没有内置函数允许根据单元格的格式选择单元格。但在 this OOo forum
我有一个百分比表: A | B | C ------------------- 1| 12% | 22% | 42% ------------------- 2| 52% | 2%
我有一个格式为 HH:MM 的时间值求和列。总和的格式为 [HH]:MM,可防止 HH > 23 时翻转。我希望将此值转换为十进制数表示形式。例如: A B 1 12
LibreOffice Calc 中的什么公式将计算不同 Week_Number 出现的次数?答案应该是2。 最佳答案 这个问题之前已经被问过很多次了。一种方法是在 B6 中输入以下公式然后按 Ctr
我在 Calc 电子表格中有几个数据列,每个列有 400 到 500 个条目。对于这些列中的每一列,我只想简单地找到均值和标准差,但不知道如何进行。 有人可以用简单而非技术性的语言逐步指导我如何做到这
假设我在 LibreOffice calc 中有以下电子表格: | A | B | C | D | ------------------- |1| 1 | 2 | | 2 | |2| 2 |
LibreOffice Calc 中是否有接受 的函数整数 x 和 整数 y 并以该位置吐出单元格的内容? 有一个功能ADDRESS吐出给定 [x;y] 的地址。问题是我不知道如何取消引用它。 最佳答
我希望能够在 LibreOffice Calc 中选择两个单元格,然后按某种魔术键,结果交换两个单元格的内容。 我怎么做? 我为 Excel 找到了这个解决方案,但它在 LibreOffice 中不起
我有两列有数字。当另一个有重复时,另一个只有一次数字。这些列中的数字不匹配。我需要在 B 列中找到在 A 列中匹配的所有数字。 这可能更好地解释了它: 甲乙 1 2 2 2 4 5 6 5 7 6 8
我想为 Calc 编写一个返回 #VALUE 的 Basic 函数!可使用 ISERR() 进行测试。 Function foo() foo = #VALUE! End Function 但是
我正在寻找一种使用 LibreOffice 的 Calc 从网站获取一些数据的方法。 我之前使用带有 IMPORTXML 函数的 Google 表格,但因为它非常不可靠,所以我想改用 Calc。 我的
我有这些单元格的 A 列: A1: Apple A2: Banana A3: Cherry 我想要一个公式,将它们串在一个单元格中,如下所示: "Apple, Banana, Cherry" 最佳答案
我想从 LibreOffice Calc 中多次出现的字符中获取最后一次出现。 例如我有一个字符串 abc1ba2ac2adeaa43add .现在,如果我正在搜索 a它应该返回 18。 最佳答案 使
假设我有这个这个单元格: 然后出于某种原因,我想自动反转列的顺序,变成这样: 任何帮助将不胜感激! 最佳答案 快速步骤: 在 1 上方插入新行 用单调递增的整数索引向右填充行。 然后选择您的数据并降序
我想在 LibreOffice Calc(v5.4.4.2 但可以升级)中实现一些条件格式,以突出显示其值通过公式计算而不是直接输入的单元格。 例如,一个单元格包含 =A3 将突出显示,而 Hello
我有一个 LibreOffice 3 电子表格(在 Ubuntu 11.04 上),其中有一列包含数百个超链接,这些超链接仅显示为“链接”。 我需要将这些转换为纯文本,或者更糟糕的是显示超链接而不是文
我在屏幕上有四个绝对定位的 div,它们需要在所有分辨率下保持它们的位置。 div1 - 高度 150px,顶部 0px div2 - 高度 30%,顶部 150px div3 - 高度 50 像素,
所以我很清楚,一般来说,应该在 JS 和浏览器检测中使用特征检测。 jQuery 1.9 放弃了 $.browser 就是一个很好的例子。 此外,在我阅读的每篇文章中,都说永远不要使用浏览器检测。 但
到目前为止,我一直在使用 em-calc 在我的 Zurb Foundation 元素中定义 CSS 大小。但是,最近我注意到开发人员越来越多地使用 rem-calc。 我知道每个函数的作用,但我不太
如何在另一个 CSS calc 函数中使用 CSS calc 函数?根据这个post这是可能的,但没有这样的例子。 最佳答案 It is possible to use calc() inside a
我是一名优秀的程序员,十分优秀!