css - What does hash (#) sign do outside loops in SASS? -
i've come across use of hash sign outside of loop in sass , i'm not sure it's used or reason is.
what's difference between these 2 examples please? both output same css first doesn't allow classes elements. why first example in use in places?
#{h1, h2, h3, h4, h5} { color: #000; } h1, h2, h3, h4, h5 { color: #000; }
#{}
used string interpolation: http://sass-lang.com/documentation/file.sass_reference.html#interpolation_
there 1 exception this, though: when using #{} interpolation, quoted strings unquoted. makes easier use e.g. selector names in mixins. example.
so technique used allow using sass values in selectors. e.g.:
$gutter: 10; .grid#{$gutter} { background: red; }
now question. don't see reason why use string interpolation in selector:
#{h1, h2, h3, h4, h5} { color: #000; }
my best guess sass variable added later selector, or selector replaced variable.
Comments
Post a Comment