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 How to Make a Website Responsive Web Design and Testing Adding Breakpoints for Devices

Pedro Bustillo
Pedro Bustillo
3,608 Points

With Safari: the background color of the site does not change when changing the size.

Using Safari and the following instruction is not responding to different sizes (px)

@media screen and (min-width: 480px) { body { background: navy; }
}

.... it just changes the color once regardless of the size ??

Thanks P

8 Answers

Safari has a minimum width that it's window can be, try testing on chrome with dev tools or another browser.

Pedro Bustillo
Pedro Bustillo
3,608 Points

Hi and thank you

But can you elaborate further. I am learning this program as we speak. Cheers.

Did you add your responsive.css into index.html? This code look like pretty good

Pedro Bustillo
Pedro Bustillo
3,608 Points

Yes. As I explained the background color changed to Navy once I wrote the code.... but it does not change based on the size of the Safari's screen (you know from white to Navy, etc). I don't know whether I need to do something with my Apple configuration.

Hm, this code means if your screen size more than 480px background change to Navy. Try to set screen size less than 480px and this should work

Might be silly but have you defined the css for outside a media query? this will only work from 480px and above so below that it will change to a default but its always good to define it anyway.

body {
    background-color: #fff;
}

@media (min-width: 480px) { 
    body { 
        background-color: blue; 
    }
}

try without the 'screen and' also for debugging

Pedro Bustillo
Pedro Bustillo
3,608 Points

hi all,

Thank you both for the tips and responds.

At the end this is what I did ( it is really silly): Since the color did not change after reducing the size of the screen as much as Safari allowed me, I increased the min-width in the coding to 600px and now it works. Maybe because this Mac is retina-display, even the smallest screen don't get to lower than 480px (I have no idea)

Now, if I the above is correct, by any chance do you know how the developers working with these computers can cross-check that the coding works for a much lower resolution level (smart phone, etc)??

Many thanks

Pedro.

I know what you mean, yes use chrome :) it will let you go much smaller also you can use developer option and click the little mobile icon on the top left of the developer tools bar and drag the size of the viewport and even select popular device viewports.

Pedro Bustillo
Pedro Bustillo
3,608 Points

Thank you so much .... great!