_media.scss 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. // Media
  2. // Image responsive
  3. .img-responsive {
  4. display: block;
  5. height: auto;
  6. max-width: 100%;
  7. }
  8. // object-fit support is coming to Microsoft Edge
  9. // https://developer.microsoft.com/en-us/microsoft-edge/platform/status/objectfitandobjectposition/
  10. .img-fit-cover {
  11. object-fit: cover;
  12. }
  13. .img-fit-contain {
  14. object-fit: contain;
  15. }
  16. // Video responsive
  17. .video-responsive {
  18. display: block;
  19. overflow: hidden;
  20. padding: 0;
  21. position: relative;
  22. width: 100%;
  23. &::before {
  24. content: "";
  25. display: block;
  26. padding-bottom: 56.25%; // Default ratio 16:9, you can calculate this value by dividing 9 by 16
  27. }
  28. iframe,
  29. object,
  30. embed {
  31. border: 0;
  32. bottom: 0;
  33. height: 100%;
  34. left: 0;
  35. position: absolute;
  36. right: 0;
  37. top: 0;
  38. width: 100%;
  39. }
  40. }
  41. video.video-responsive {
  42. height: auto;
  43. max-width: 100%;
  44. &::before {
  45. content: none;
  46. }
  47. }
  48. .video-responsive-4-3 {
  49. &::before {
  50. padding-bottom: 75%; // Ratio 4:3
  51. }
  52. }
  53. .video-responsive-1-1 {
  54. &::before {
  55. padding-bottom: 100%; // Ratio 1:1
  56. }
  57. }
  58. // Figure
  59. .figure {
  60. margin: 0 0 $layout-spacing 0;
  61. .figure-caption {
  62. color: $gray-color-dark;
  63. margin-top: $layout-spacing;
  64. }
  65. }