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
jes cahn-thompson
Front End Web Development Techdegree Student 6,719 Pointschoosing the most appropriate css element
What's considered the most appropriate CSS element to use when coding a one-page site that has a photo gallery with captions?
div? figure? Neither of these? Is simply using img fine? Thanks in advance.
1 Answer
Abraham Juliot
47,353 PointsHi jesse cahn thompson
The html img element should be fine for a gallery. The figure element represents a self-contained flow content and is "typically" referenced as one unit. The div element is without any special meaning, though it does a great job at parenting and representing it's children. It should only be used if there is no other "more semantically appropriate" element to suit your purpose, and this may be the case for stylistic and interactivity purposes. I recommend doing a search on codepen.io for "image gallery" or "pure css image gallery". There may be some creative examples. Joyful coding to you :)
jes cahn-thompson
Front End Web Development Techdegree Student 6,719 Pointsjes cahn-thompson
Front End Web Development Techdegree Student 6,719 Pointsthanks abraham!