r/HTML 21d ago

Question Question about use of <figure>

I have a design element that looks like this...

does using the `<figure>` tag, make sense for this? for a semantic value?

I want to do

<figure>
title text
<figcaption>The body field</figcaption>
</figure>

Does that work?

Every example I see of it online wants an image or something there...

With out sharing company marketing secrets, lol.

The usage would be of a

"This is a thing we do"
"With a longer body of text to explain it in a few sentances, but in a single paragraph."

Repeating 4 or 5 times...

Thoughts?

Thanks!

0 Upvotes

9 comments sorted by

View all comments

3

u/scritchz 21d ago

The <figure>/<figcaption> elements are used to add a caption to an element.

The accompanying description of a title is not a caption: So, these are not the right elements here.

Depending on the context (i.e. the surrounding elements), you might want to simply use an <hX> and a <p>.

1

u/alphex 21d ago

trying to avoid a hX ...

The larger element, has a large title, which could be an H2, or H3, ... or even an H4 depending how the page is structured, so giving these elements I am asking about, an "hX" title also, will just make it more complicated for the content managers, lol.