I saw someone use…
<figure>
<img ........>
</figure>
…for a project. Do I need or should I use if I’m placing an image on a page?
What’s the standard parctice when we use ?
tx guy’s
I saw someone use…
<figure>
<img ........>
</figure>
…for a project. Do I need or should I use if I’m placing an image on a page?
What’s the standard parctice when we use ?
tx guy’s
A figure is just a container for media of some kind, normally with a caption (the <figcaption>
element). Like a <nav>
element has navigation, or a <header>
has header content, or <main>
has the main webpage content. Could be image/s, video/s, audio, text, graphics, whatever.
It’s not necessary, it’s just for better structuring of pages. For example, you normally put an alt
attribute on an image that describes the image. If it’s in a figure, you can put the description in the caption instead, and a screenreader or whatever will understand that.
It’s a figure as in a figure in a book, literally the same.
It’s just semantic naming… like
<header>
<footer>
As opposed to just calling them
<div>
<div>
or before that in the stone age days.
<table>
<table>
Other semantic elements are
<article>
<aside>
<details>
<section>
<summary>
etc…
Oh I get it… that’s cool and I’ll use that. I definitely want my pages to be legit.
tx man.
can you help out with my other posts this morning too lol
it’s called Semantic naming. Like it’s a thing and thats what the thing is called.
Got it! Stone Age lol