2013-07-31 38 views
2

引起多錯誤在Visual Studio 2012,我想用下面的Firefox特定的CSS在我的外部造型片之一:火狐特定的CSS在Visual Studio

@-moz-document url-prefix() { 
    .span4 ul li a:focus { border: none; } 

    .span12, #announcement.span4, #mainContent .span16 { box-shadow: 8px 4px 19px -2px #CFCFCF; } 
} 

但每當我接近結束在@-moz-document url-prefix選擇,我在CSS的兩行得到了一些錯誤,下面將進一步描述: the area(s) of code causing error

線500,我得到了錯誤的順序從左向右:

  • Missing a property name before the colon "(:)" in the "(property) : "(value)" declaration - 這是這個詞焦點
  • Missing a selector in the style rule後的空間 - - 其可以在類選擇
  • The block is unclosed, '}' is expected中找到,其與「{」字符

在線503,我得到:Unexpected character sequence.與'}'字符

我找到了相同的Firefox解決方案,似乎在其他地方工作。我已經註釋掉並從樣式表中刪除了以下CSS。但是,Visual Studio沒有發現任何錯誤。有沒有辦法使Visual Studio中的以下Firefox特定的CSS工作,而不會給我錯誤?

UPDATE:作爲@Leigh在此following question評論說,我試着按CTRL + d,CTRL + K,但它仍然給了我同樣的錯誤如前。唯一的區別是它給了我第一類.span4 ul li a:focus結束時的分號以及500行上的錯誤。

+0

而奇怪的是,VS確實將@ -moz-document指令識別爲「一個基於URL的文檔中限制其中包含的樣式規則的Gecko特定規則」。所以它不像它認爲整個@規則是一個普通的選擇器。 –

+0

@MrLister我同意。它識別規則_and_以某種方式接受'@ -moz-document'選擇器中的第二個選擇器。 – Abriel

回答

0

我發現了一些可能的解決方案 - 雖然我不是非常熟悉@ -moz文檔選擇器,所以我不確定這些是否會做同樣的事情。此鏈接(​​)或此(http://css-tricks.com/snippets/css/css-hacks-targeting-firefox/)可能會有所幫助。

/* Target Firefox 1.5 and newer [!] */ 
.selector, x:-moz-any-link, x:only-child { color: red; } 

/* Target all Firefox */ 
#selector[id=selector] { color: red; } 

/* Target all Firefox */ 
@-moz-document url-prefix() { .selector { color: red; } } 

/* Target all Gecko (includes Firefox) */ 
*>.selector { color: red; } 

祝您好運!

+0

我絕對發現這些是使用VS2012的唯一解決方案。我不知道爲什麼它會識別其他語法,但會給出錯誤。希望別人解決這個問題,並找到有用的。 – Abriel