我的 css 样式表上有这个疯狂的错误 - 在所有浏览器中测试过,但不起作用。这是错误:
VM2952 LiveUpdateTools.js:688 Uncaught DOMException: Failed to execute 'insertRule' on 'CSSStyleSheet': Failed to parse the rule '.about #2015-marker-label { top: calc(86vh - 6px); }'.
at Object.insertRule (http://127.0.0.1:59944/static/files/LiveUpdateTools.js:688:12)
at http://127.0.0.1:59944/static/files/deviceClientScript.js:390:23
这是css样式表:
.about .marker-text {
left: calc(50% + 28px);
position: absolute;
color: black;
font-family: Lato;
font-size: 12px;
font-weight: 400;
letter-spacing: 0.5px;
}
.about #2000-marker-label {
top: calc(12vh - 6px);
}
.about #2005-marker-label {
top: calc(32vh - 6px);
}
.about #2010-marker-label {
top: calc(52vh - 6px);
}
.about #2015-marker-label {
top: calc(86vh - 6px);
}
最后是 HTML 标记:
<label id="2000-marker-label" class="marker-text">2000</label>
<label id="2005-marker-label" class="marker-text">2005</label>
<label id="2010-marker-label" class="marker-text">2010</label>
<label id="2015-marker-label" class="marker-text">2015</label>
在 body 元素上有一个名为“about”的类,因此在所有样式表选择器上都有 .about。没有设置 top 属性,我认为这是错误造成的。这不像我在这里做任何疯狂的事情,我用谷歌搜索了这个错误并得到了 2 个过时的结果,说这是 chrome 中的一个问题。无论如何,谢谢你能给我的任何帮助,我很感激。