2011-04-27 44 views
1

如果SASS文件內容在Sass中,註釋不能跨越2行或3行,如果它在行尾?如何使它工作?

#some-div 
    color: #333 
    font-size: 17px // This value actually has some issue on WebKit because it makes 
        // the label a little off centered, and is better if it is 16px. 
        // But on IE, the font turns out to be rather ugly, so we would 
        // use 17px for now since IE has a larger user base 

上面會真的失敗,因爲它會抱怨壓痕是不正確的(開始的評論的第二行)。如何解決這樣的多行? 注意:它可以被製作成與font-size行一樣的縮進(在它的頂部),但是我寧願不這樣做。

+0

爲什麼你在標題中添加'(或scss)'?如果您使用scss語法,這將工作得很好。 – Dogbert 2011-04-27 13:37:30

+0

是對的......這很好,我可以刪除scss,因爲我認爲它們非常相似 – 2011-04-27 13:55:54

回答

1

Sass非常基於縮進。因此,除了要麼

  • 將註釋結合到行的末尾,這將是巨大而笨拙的。
  • 將註釋移到您的線條的上方或下方。

縮進語法的文檔包含註釋in this section。 您可能會發現一些有用的選項,例如,您只需要將註釋的第一行用斜槓表示,其餘部分可以縮進,這對您的目的而言可能更易讀。 它應該是這樣的,那麼:

#some-div 
    color: #333 
    font-size: 17px  
    // This value actually has some issue on WebKit because it makes 
    the label a little off centered, and is better if it is 16px. 
    But on IE, the font turns out to be rather ugly, so we would 
    use 17px for now since IE has a larger user base. 

SCSS是所有有效的CSS是有效SCSS現在使用首選語法;它還允許您想要的評論類型(除了一些非常漂亮的附加內容,例如在選擇器內部使用&:hover以更加邏輯地將樣式上的變體分組)。

相關問題