html - string concatenation in css -


i want achieve following in css. how do in way works in ie8+

url('../img/icons/' + attr('type') + '_10.png') 

you can't dynamic string interpolation in way you're suggesting, if have limited number of possible values [type] attribute, create styles each one:

.your .selector[type="foo"] {     background-image: url('../img/icons/foo_10.png'); } .your .selector[type="bar"] {     background-image: url('../img/icons/bar_10.png'); } .your .selector[type="baz"] {     background-image: url('../img/icons/baz_10.png'); } 

if you've got unreasonable number of types, you'll need come better solution i've listed here.


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -