css - How to set a div size to its background image size -
<div class="newsblocks"></div>
css:
.newsblocks{ background: url(../img/news/1.png); }
how set div size of 1.png?
it's not possible auto-size div based on size of it's background image, (hacky) way, including img
tag url image, setting img
visibility:hidden;
[used inline css brevity - don't kill me!]:
<div style="background-image: url('img.jpg');"> <img src="img.jpg" style="visibility:hidden"/> </div
Comments
Post a Comment