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 Basics (2014) Enhancing the Design With CSS Adjusting the Layout with Media Queries

Arikaturika Tumojenko
Arikaturika Tumojenko
8,897 Points

I get a scroll bar at the bottom of the page after I add media queries for (max-width 768px).

After I add

@media (max-width: 768px) {

.primary-content, .secondary-content { width: 100%; padding: 20px; border: none; } }

the two columns do not shrink as I make the browser windows smaller, instead I get a scroll bar at the bottom of the page. I work along in Sublime and my spacework is not working so I can't compare codes. What am I doing wrong?

Marko Nestorovic
Marko Nestorovic
12,441 Points

Could you please copy your code? Thank you.

1 Answer

Ben Schroeder
Ben Schroeder
22,818 Points

In this code...

.primary-content, .secondary-content { width: 100%; padding: 20px; border: none; } }

... you're giving the elements a width of 100% and ADDING the padding to that 100%, so the total width of the element exceeds 100% of the viewport.

Try using box-sizing: border-box;.