You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

lite-yt-embed.css 2.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. lite-youtube {
  2. background-color: #000;
  3. position: relative;
  4. display: block;
  5. contain: content;
  6. background-position: center center;
  7. background-size: cover;
  8. cursor: pointer;
  9. max-width: 720px;
  10. }
  11. /* gradient */
  12. lite-youtube::before {
  13. content: attr(data-title);
  14. display: block;
  15. position: absolute;
  16. top: 0;
  17. /* Pixel-perfect port of YT's gradient PNG, using https://github.com/bluesmoon/pngtocss plus optimizations */
  18. background-image: linear-gradient(180deg, rgb(0 0 0 / 67%) 0%, rgb(0 0 0 / 54%) 14%, rgb(0 0 0 / 15%) 54%, rgb(0 0 0 / 5%) 72%, rgb(0 0 0 / 0%) 94%);
  19. height: 99px;
  20. width: 100%;
  21. font-family: "YouTube Noto",Roboto,Arial,Helvetica,sans-serif;
  22. color: hsl(0deg 0% 93.33%);
  23. text-shadow: 0 0 2px rgba(0,0,0,.5);
  24. font-size: 18px;
  25. padding: 25px 20px;
  26. overflow: hidden;
  27. white-space: nowrap;
  28. text-overflow: ellipsis;
  29. box-sizing: border-box;
  30. }
  31. lite-youtube:hover::before {
  32. color: white;
  33. }
  34. /* responsive iframe with a 16:9 aspect ratio
  35. thanks https://css-tricks.com/responsive-iframes/
  36. */
  37. lite-youtube::after {
  38. content: "";
  39. display: block;
  40. padding-bottom: calc(100% / (16 / 9));
  41. }
  42. lite-youtube > iframe {
  43. width: 100%;
  44. height: 100%;
  45. position: absolute;
  46. top: 0;
  47. left: 0;
  48. border: 0;
  49. }
  50. /* play button */
  51. lite-youtube > .lyt-playbtn {
  52. display: block;
  53. /* Make the button element cover the whole area for a large hover/click target… */
  54. width: 100%;
  55. height: 100%;
  56. /* …but visually it's still the same size */
  57. background: no-repeat center/68px 48px;
  58. /* YT's actual play button svg */
  59. background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 68 48"><path d="M66.52 7.74c-.78-2.93-2.49-5.41-5.42-6.19C55.79.13 34 0 34 0S12.21.13 6.9 1.55c-2.93.78-4.63 3.26-5.42 6.19C.06 13.05 0 24 0 24s.06 10.95 1.48 16.26c.78 2.93 2.49 5.41 5.42 6.19C12.21 47.87 34 48 34 48s21.79-.13 27.1-1.55c2.93-.78 4.64-3.26 5.42-6.19C67.94 34.95 68 24 68 24s-.06-10.95-1.48-16.26z" fill="red"/><path d="M45 24 27 14v20" fill="white"/></svg>');
  60. position: absolute;
  61. cursor: pointer;
  62. z-index: 1;
  63. filter: grayscale(100%);
  64. transition: filter .1s cubic-bezier(0, 0, 0.2, 1);
  65. border: 0;
  66. }
  67. lite-youtube:hover > .lyt-playbtn,
  68. lite-youtube .lyt-playbtn:focus {
  69. filter: none;
  70. }
  71. /* Post-click styles */
  72. lite-youtube.lyt-activated {
  73. cursor: unset;
  74. }
  75. lite-youtube.lyt-activated::before,
  76. lite-youtube.lyt-activated > .lyt-playbtn {
  77. opacity: 0;
  78. pointer-events: none;
  79. }
  80. .lyt-visually-hidden {
  81. clip: rect(0 0 0 0);
  82. clip-path: inset(50%);
  83. height: 1px;
  84. overflow: hidden;
  85. position: absolute;
  86. white-space: nowrap;
  87. width: 1px;
  88. }