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 trialJuan Ferreras
28,028 PointsIsn'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
myackley35
34,574 PointsJuan,
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
28,028 PointsJuan Ferreras
28,028 PointsYeah, I understand now! Thanks for the example!