html - Can I Specify Variable Names In A CSS File -


i in process of adding background images couple of hundred web pages. app doesn't know until runtime image load. have been able work fine changing statement in of pages contain attributes need plus variables image file name, etc:

<body style="margin:0; background-image: url(<%= strbackgroundimage %>); background-repeat: <%= strbackgroundrepeat %>"> 

while above statement works, rather put attribute info css file this:

body {     margin:0;      background-image: url(<%= strbackgroundimage %>);      background-repeat: <%= strbackgroundrepeat %>; } 

but doesn't work. attributes containing variable names ignored. how can modify above snippet work in css file , still allow me set variables' contents in code behind files?

thanks.

in short

no cannot pass variables in css.

sass or scss

sass , scss support variables.

http://sass-lang.com/

less

less supports variables too

http://lesscss.org/


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -