DEV Community

Discussion on: Code block $ prefix

Collapse
 
dennisk profile image
Dennis Keirsgieter

Would it also be possible to say if you don't pass on a prefix in the html it shows default ($) and otherwise use the prefix? Seems a bonus on top the bonus to me!

Collapse
 
glennmen profile image
Glenn Carremans

Good question! I did a quick search and actually you can. developer.mozilla.org/en-US/docs/W...

attr() has an optional fallback, however this is still an experimental feature.

content: attr(prefix, "$");
Collapse
 
dennisk profile image
Dennis Keirsgieter • Edited

And here i am looking at the docs and missing the last part about the fallback.. Thanks for that! Doesn't seem to work in my version of chrome yet tho.