html - img tag without src attribute but with class attribute gives a random display -
i come across 1 question in stackoverflow user want give icon in html, not using
<img src="smiley.gif" alt="smiley face" width="42" height="42"> but, using class like
<img class="iconclass"> and css class is
.iconclass{ background:url('smiley.gif')!important; } i tried this, works me, wierd thing that, image getting repeated till width , height specified. why happening, , how solve it?

background repeat default set repeat. should set:
.iconclass{ background-repeat: no-repeat; } or :
.iconclass{ background:url('smiley.gif')!important no-repeat; }
Comments
Post a Comment