On one of my pages there is an image. I need help deciding how it should be marked up—or rather, where it should be in the source. <img> isn’t valid in the body directly, so I have a few choices:
- Contain it in the previous paragraph (how it is currently)
- Leave it outside the paragraph, which is invalid, but more semantically correct (I think?)
- Put a
<div>, which would be valid and semantically correct but redundant (or would it be? does having thedivthere mean the existance of something that shouldn’t be there?) - Use
<object>instead, which would be semantically correct and valid, but I’d have to look up the syntax for
So which should I chose?
Edit: Eep, forgot to close my <a> tag… actually, forgot to even give it content. Fixed now.
If you are only using Firefox, I’d go with
objectfor semantic reasons. For general use I think putting it into the paragraph is more semantic, since it belongs with the rest of the information in that paragraph. Otherwise, the most practical option for the web today is probably to use a div element for compatibility reasons and the generally OK semantics.