Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML

Seokhyun Wie
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Seokhyun Wie
Full Stack JavaScript Techdegree Graduate 21,606 Points

Is <figure> attribute used for a communicative reason only? There is no visual difference whether I delete it or not.

Hi, I am Brandon.

  1. 'tag' and 'figcaption' attributes inside an <img> attribute have visible changes on the page: -tag: when you hover your mouse, you can see what you wrote with tag attribute -figcaption: what you wrote with 'figcaption' attribute will be located under the image

  2. However, I deleted <figure> attribute and retype it, there was no different on the webpage.

  3. So, can you explain about this <figure> attribute why does it need? For what purpose?

Thank you so much for your time and help. :)

2 Answers

Steven Parker
Steven Parker
231,008 Points

For proper HTML, a "figcaption" element should only be the first or last direct child of a "figure" element.

And besides the semantic value, the "figure" element also serves as a convenient target container for styling and layout using CSS. It may not have a different visual appearance by default, but you can always give it one in your stylesheet. Most of the the newer semantic elements are like that.

Steven Parker
Steven Parker
231,008 Points

Generic containers like "div" and "span" don't convey any semantic meaning. I'd consider this one more like "article", "nav" or "aside". On their own, they don't affect the appearance but they might have meaning to search engines or other content-aware processes.