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

eslam said
PLUS
eslam said
Courses Plus Student 6,734 Points

images

lets say i`m creating a portfolio layout and i have like 10 images as the main design, should i use 1 div to wrap all my images inside it or use individual div for each images or should i use the figure or article to wrap my images

4 Answers

Steven Parker
Steven Parker
231,109 Points

It's easy to get carried away with unnecessary containers. Before wrapping an individual element with another, I'd think if perhaps there's another way to accomplish the objective.

For example, if you wanted to style an individual image differently from the others, you could give it an "id" property.

Even when containing multiple elements ... is there something you need a container for that can't be done with a selector that targets all the elements? Sometimes you may want to group things together for structure, and that's fine, but try not to get into the habit of wrapping things without a specifc reason.


Normally, I wouldn't give images fixed pixel sizes. If you use percentages or screen-relative units your images will expand and shrink to make better use of the window size the page is being viewed in.

James Tew
James Tew
2,774 Points

I personally would use a 'wrapper' div and then individual divs for the images. My logic for this is because you can apply universal styles as required to the images and then if you wanted to target specific images, you still have the individual divs.

eslam said
PLUS
eslam said
Courses Plus Student 6,734 Points

Thanks james i appreciate your answer and excuse me i have another one :

do you give fixed size for your images ?