How can I replace this tag:
<img src="images/username_t.png" />
to use CSS?
How can I show an image using CSS styles?
Html:
<div id="pic"></div>
CSS:
#pic {
background-image: url('images/username_t.png');
width: 100px; /* image width */
height: 100px; /* image height */
display: inline-block; /* so that it behaves like the img element */
}
For css, there are a few options dealing with background images, so check these out as well:
background-attachment
background-image
background-position
background-repeat
background-clip
background-origin
background-size
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With