css - Something like an If statement -


in css, want like:

:root{       underline-all-h1-tags:true   }   /* it's not h1 tags, it's h1-tags-with-a-bunch-of-other-things". kiss reasons, we'll assume it's of them.*/  /* ... lots , lots of other stuff...*/  h1{       if(underline-all-h1-tags == true){          text-decoration: underline       } else {         text-decoration:none       } } 

is there way this? know

:root{h1-underline:underline}   h1{text-decoration:var(h1-underline)} 

but trying make code readable me-in-10-years-when-i-have-totally-forgotten-how-to-css.

why not make use of cascading part of cascading style sheet?

h1{     text-decoration:none; }  .underline h1{     text-decoration:underline; } 

applying class "underline" parent element same thing looks you're trying describe above.

you add or remove underline class js, or set statically on elements want affected.


Comments

Popular posts from this blog

node.js - NodeJS remote terminal to Dropbear OpenWRT-Server -

python - jinja2: TemplateSyntaxError: expected token ',', got 'string' -

Qt4: how to send QString inside a struct via QSharedMemory -