You are here

blazy.ratio.css in Blazy 8

Same filename and directory in other branches
  1. 8.2 css/components/blazy.ratio.css
  2. 7 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. [data-blazy],
  6. [data-blazy] * {
  7. -ms-box-sizing: border-box;
  8. -webkit-box-sizing: border-box;
  9. box-sizing: border-box;
  10. }
  11. .media {
  12. position: relative;
  13. }
  14. /**
  15. * Aspect ratio element wrapper. So can use dynamic/fluid ratio via JS which is
  16. * not possible using ::pseudo selector approach.
  17. */
  18. .media.media--ratio {
  19. display: block;
  20. height: 0;
  21. overflow: hidden;
  22. width: 100%;
  23. }
  24. /* Allows to fix broken images with hidden elements, see slick.load.js. */
  25. .media.js-media--ratio {
  26. height: auto;
  27. }
  28. /* Aspect ratio element: IMG, IFRAME, DIV. */
  29. .media--ratio .media__element {
  30. display: block;
  31. height: 100%;
  32. left: 0;
  33. position: absolute;
  34. top: 0;
  35. width: 100%;
  36. z-index: 0;
  37. }
  38. /* 1:1 ratio */
  39. .media--ratio--11 {
  40. padding-bottom: 100%;
  41. }
  42. /* 3:2 ratio */
  43. .media--ratio--32 {
  44. padding-bottom: 66.66%;
  45. }
  46. /* 4:3 ratio */
  47. .media--ratio--43 {
  48. padding-bottom: 75%;
  49. }
  50. /* 8:5 ratio */
  51. .media--ratio--85 {
  52. padding-bottom: 62.5%;
  53. }
  54. /* 16:9 ratio */
  55. .media--ratio--169 {
  56. padding-bottom: 56.25%;
  57. }
  58. /* Be sure to add width to the container accordingly, otherwise collapsed. */
  59. .field[data-blazy] {
  60. min-width: 50%;
  61. }