W3Cschool
恭喜您成為首批注冊(cè)用戶
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
多行注釋中的插值在生成的CSS中解析。您可以在花括號(hào)中指定變量或?qū)傩悦Q。
$var : "value"; /* multiline comments #{$var} */
下面的示例演示了在SCSS文件中的多行注釋中使用插值:
<html> <head> <title>SASS comments</title> <link rel="stylesheet" type="text/css" href="style.css"/> </head> <body> <h1>Welcome to TutorialsPoint</h1> <p>This is an example for Interpolation in SASS.</p> </body> </html>
接下來,創(chuàng)建文件 style.scss 。
$version: "7.8"; /* Framework version for the generated CSS is #{$version}. */
您可以通過使用以下命令讓SASS查看文件并在SASS文件更改時(shí)更新CSS:
sass --watch C:\ruby\lib\sass\style.scss:style.css
接下來執(zhí)行上面的命令,它將用下面的代碼自動(dòng)創(chuàng)建 style.css 文件:
/* Framework version for the generated CSS is 7.8. */
讓我們執(zhí)行以下步驟,看看上面的代碼如何工作:
將上述html代碼保存在 sass_comments_interpolation.html 文件中。
在瀏覽器中打開此HTML文件,將顯示如下輸出。
Copyright©2021 w3cschool編程獅|閩ICP備15016281號(hào)-3|閩公網(wǎng)安備35020302033924號(hào)
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號(hào)
聯(lián)系方式:
更多建議: