I’m wondering what the best way is to put pictures on a webpage along with captions.
Welcome to the forums, @hngaylor.
As with so many things in HTML/CSS, there is no single “best” way to do this. The best approach will depend on the context and content. You could use <p>
tags to mark up the caption and then wrap it and the image in a div to keep them together. Alternatively, there’s the newer <figure>
and <figcaption>
elements in HTML5, but their usage is slightly more specific. See https://developer.mozilla.org/en/docs/Web/HTML/Element/figure
More information about your project would make it easier to offer recommendations.
Here’s an old example of captions using the figure element.
As TechnoBear said above it all depends on context as there may be special requirements to take into consideration.
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.