2017-09-02 63 views
0

我的css樣式表上有這個瘋狂的錯誤 - 在所有瀏覽器上都測試過了,並且不起作用。這裏的錯誤:CSS樣式表錯誤-DOMException無法在css.stylesheet上插入規則

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。 頂部的屬性沒有被設置,我認爲這是錯誤。這不像是我在這裏做了任何瘋狂的事情,我搜索了這個錯誤,並得到了兩個過時的結果,說這是一個鉻合金問題。 無論如何感謝您可以給我的任何幫助,我欣賞它。

+0

這是什麼瀏覽器?它可能不支持使用calc()的vh/vw() – Win

+0

所有這些,最新的chrome,最新的邊緣,Firefox,即。絕對支持vh在計算:) –

+0

我已經縮小它與選擇器的錯誤。我試過其他屬性,它們沒有設置,並且彈出相同的錯誤。 –

回答

0

錯誤修正 - 不知道標識符不能以數字開頭!奇怪...