Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS How to Make a Website Styling Web Pages and Navigation Make a CSS Image Gallery

Ryan Bent
Ryan Bent
6,433 Points

Keeps telling my i've only set one margin

I'm stuck on what to put it says i'm stuck on one margin

1 Answer

Okay. In the challenge, you will have to use margin property in two places.

First you have to remove the margin for gallery ID. You can do that by using following CSS code

#gallery{
    margin: 0;
    /** The above code technically sets the margin to zero. Meaning from most left edge of browser screen **/
}

I use #(hash) because it is an ID.

Next you have to set margin for list item inside gallery ID. List items are denoted in HTML as <li> In CSS, list items are denoted by "li".

To set margin for list items inside gallery ID. You will have to use descendent selector.

#gallery li{
     margin: 2.5%;
}

I hope it helps.

Ryan Bent
Ryan Bent
6,433 Points

Ah! That makes sense. Great, thank you!