Reputation: 221
I am trying to change the background color of my image. Normally, to do this, I use;
.img {
background-image: url("./image.jpg");
background-color: "#3333";
}
But I am trying to do the same thing using the html img tag. But this doesn't seem to work. So in a form;
<div class="container">
<img class="image" src="./image.jpg"/>
</div>
Upvotes: 0
Views: 277
Reputation: 101
In css...
.name -> Style is assigned to a "class="
#name -> Style is assigned to an "id="
name -> Style is assigned to an tag <name></name>
You can try this: (Change .img to img in your CSS)
img {
background-image: url("./image.jpg");
background-color: #333;
}
<div class="container">
<img class="image" src="./image.jpg"/>
</div>
Note: You will probably need a .png or other transparent image to see the background through the image.
Upvotes: 1