Html <img> background
Is it possible to add a background-image to an img-tag? I tried like this: <img src = "imageOne.png" style = "height: 500px; width: 250px; background-image: imageTwo.jpg; opacity: 0.5;" /> It didn't get a background at all. Please note that imageOne and imageTwo are only example names, not the real ones.
9/23/2018 10:16:08 AMJoel Kronqvist
3 AnswersNew Answer
This might be a concept to revisit later, but... Most of the time, backgrounds are for aesthetics, so it's better to put them in the stylesheet as suggested in the prior post. If a background image also happens to have semantic value (adds meaningful content), then consider leaving it in the HTML file in an img tag. More on what to weigh here: https://stackoverflow.com/questions/492809/when-to-use-img-vs-css-background-image
OK, thank you everyone, I didn't know that url() was necessary🤦 I simply wrote the images name...