2x.less 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /******************************************************************
  2. Site Name:
  3. Author:
  4. Stylesheet: Retina Screens & Devices Stylesheet
  5. When handling retina screens you need to make adjustments, especially
  6. if you're not using font icons. Here you can add them in one neat
  7. place.
  8. ******************************************************************/
  9. /*
  10. EXAMPLE
  11. Let's say you have an image and you need to make sure it looks ok
  12. on retina screens. Let's say we have an icon which dimension are
  13. 24px x 24px. In your regular stylesheets, it would look something
  14. like this:
  15. .icon {
  16. width: 24px;
  17. height: 24px;
  18. background: url(img/test.png) no-repeat;
  19. }
  20. For retina screens, we have to make some adjustments, so that image
  21. doesn't look blurry. So, taking into account the image above and the
  22. dimensions, this is what we would put in our retina stylesheet:
  23. .icon {
  24. background: url(img/test@2x.png) no-repeat;
  25. background-size: 24px 24px;
  26. }
  27. So, you would create the same icon, but at double the resolution, meaning
  28. it would be 48px x 48px. You'd name it the same, but with a @2x at the end
  29. (this is pretty standard practice). Set the background image so it matches
  30. the original dimensions and you are good to go.
  31. */