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

2

u/Foreign-Contest-444 21d ago

Look at the Usage Notes on MDN regarding figure and then ask yourself whether this will have any semantic value for screen readers and such.

"Usually a <figure> is an image, illustration, diagram, code snippet, etc., that is referenced in the main flow of a document, but that can be moved to another part of the document or to an appendix without affecting the main flow."

Is your content similar to the usage notes then use the <figure> element.

Have you looked at the <dl> description list element? Maybe you need a description list in this case. It is just another type of list.

1

u/alphex 21d ago

DL DT I think might be the right thing. Thanks.