I'm setting an image using a <div> tag like this:
<div id="logo"></div>
and here's the CSS:
#logo {
background: url(../images/logo.png) no-repeat center;
width: 180px;
height: 82px;
float: right;
padding: 15px 15px 0 10px;
position: relative;
}
How do I set an alt="" attribute for the image?
thanks!
It is impossible to set an <img alt=""> with css. But this can be done with JavaScript Example
<div class="logo><img src="../image.png"></div>
document.getElementByTagName('img').alt = "Anything";
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