You are here

blazy.ratio.css in Blazy 7

Same filename and directory in other branches
  1. 8.2 css/components/blazy.ratio.css
  2. 8 css/components/blazy.ratio.css

The CSS and class names below are based on Slick media for easy migration.

File

css/components/blazy.ratio.css
View source
  1. /**
  2. * @file
  3. * The CSS and class names below are based on Slick media for easy migration.
  4. */
  5. /* Touch me not! */
  6. .media {
  7. position: relative;
  8. }
  9. /**
  10. * Aspect ratio element wrapper. So can use dynamic/fluid ratio via JS which is
  11. * not possible using ::pseudo selector approach.
  12. */
  13. .media.media--ratio {
  14. display: block;
  15. height: 0;
  16. overflow: hidden;
  17. width: 100%;
  18. }
  19. /* Aspect ratio element: IMG, IFRAME, DIV. */
  20. .media--ratio .media__element {
  21. display: block;
  22. height: 100%;
  23. left: 0;
  24. position: absolute;
  25. top: 0;
  26. width: 100%;
  27. z-index: 0;
  28. /** Temp fix, also to fix the VIDEO element to max width, not only IMG. */
  29. object-fit: cover;
  30. }
  31. /* 1:1 ratio */
  32. .media--ratio--11 {
  33. padding-bottom: 100%;
  34. }
  35. /* 3:2 ratio */
  36. .media--ratio--32 {
  37. padding-bottom: 66.66%;
  38. }
  39. /* 4:3 ratio */
  40. .media--ratio--43 {
  41. padding-bottom: 75%;
  42. }
  43. /* 8:5 ratio */
  44. .media--ratio--85 {
  45. padding-bottom: 62.5%;
  46. }
  47. /* 16:9 ratio */
  48. .media--ratio--169 {
  49. padding-bottom: 56.25%;
  50. }