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

CSS CSS Layout Basics Getting Started with CSS Layout Centering Page Content and Creating a Full-width Header

Tomáš Komprs
Tomáš Komprs
14,057 Points

Why from 2 same container is affected just One?

We created 2x same div/classes <div class="container"> But why when he ,,target,, class .container in css is affected just the second one from ,,main,, content? It should affect the both no?

Frans de Haan
Frans de Haan
6,315 Points

Hello Tomáš,

It's difficult to answer on a question without the seeing the code.

If I hear your question, I think it's because you forget somewhere to close another div or open a div and doesn't close it.

Please share your code for a better answer.

2 Answers

Frans de Haan
Frans de Haan
6,315 Points

Hello,

It's still diffecult to see the exact problem with html only. Can you share your workspace here.

By going to workspaces, then click the workspace you are working in and inside it on make a snapshot the link from the snapshot you can share with us.

The first container is inside the header so only the content inside the container is narowed down. The background-color is specified to the header and streches still to the edges of the screen.

Tomáš Komprs
Tomáš Komprs
14,057 Points

I think I right now figure out what was ,,the problem,,. He put <div> inside header insted out of header. And because of that, this have a influence only on the content inside of course.. :-D Sorry I bothering you with a silly thing like this. But, Thank you a much for helping me!! Have a nice day :)

kathryn armitage
kathryn armitage
12,185 Points

I had the same issue. I then put the div outside of the header BUT it showed up with red highlighted text like it was wrong but it worked! :/