What's the best practice and established way to portray an image? I am working from the assumption that it shouldn't be done in HTML anymore so I am not using the img
tag in my markup. Instead, I am linking the image in my CSS via background: url('dir')
. If I am already going wrong with this assumption, let me know.
If linking an image in CSS is the correct (or at least a good, well established) way to go, then the next question is what HTML tag to use in the document? Technically, images can be applied to just about any element in HTML, so which one's the right one to use?
Case in point: Right now I am working on a row of icons where each icon has some text underneath it. At the moment, I have it set up as an unordered, horizontal list and I am applying the image and text in my CSS to each individual list item tag. However, there are several other ways I could do this. I could have a row of divs
or spans
, for example. Or I could use the img
tag without defining the src
property in the HTML and instead setting it in the CSS (at least I think this is possible). Or several other ways I can think.
What is the best practice in cases like this?