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 Adding Pages to a Website Add Iconography

Juan Ferreras
Juan Ferreras
28,028 Points

Isn't the approach of forcing the user to load an image twice as big on regular devices really bad for loading times?

Isn't it better to detect whether it's a retina device, or not, and the whole @2x deal?

1 Answer

Juan,

In the context of material being taught in the video adding a background-image without checking for pixel density is ok. However, you are correct in the fact that you can take the code a little farther by swapping out images with a media query that looks for certain pixel densities such as (but not limited to):

@media 
(-webkit-min-device-pixel-ratio: 2), 
(min-resolution: 192dpi) {
ul > li a {
background-image: url("thisimage-2x.png");
}
}

How you build things is kind of subjective anyway depending on your workflow and what you're trying to achieve. Neither way is the wrong way to code.

I hope this clears things up!

Juan Ferreras
Juan Ferreras
28,028 Points

Yeah, I understand now! Thanks for the example!