0

There is no background image visible after clicking the red play image, why is it not visible, and how would I get it to be visible?

How it works is, you click on the red play image then the video shows after.

There's supposed to be a background gradient image showing filling the screen behind the video.

https://jsfiddle.net/7ckned6L/

.containera-inner{
    display: flex;
    flex: 1 0 0%;
    background-image:
    linear-gradient
}

<div class="containera hide">
  <div class="containera-inner">
    <div class="video-wrapper">
      <div class="ratio-keeper">
        <div class="wrapa">
          <div class="video video-frame"></div>
        </div>

In the image provided, there's supposed to be a gradient background image behind it and it is not able to be seen.

Why is it not able to bee seen, and how would that be fixed?

enter image description here

This is the background image that is not able to be seen in the code.

What would need to be fixed and adjusted so that the background image can be seen?

enter image description here

Make sure the purple is not able to be visible

enter image description here

(function manageCovera() {

  function show(el) {
    el.classList.remove("hide");
  }

  function hide(el) {
    el.classList.add("hide");
  }

  function coverClickHandler(evt) {
    const cover = evt.currentTarget;
    hide(cover);

    const thewrap = cover.parentElement.querySelector(".containera");
    show(thewrap);
  }

  const cover = document.querySelector(".playa");
  cover.addEventListener("click", coverClickHandler);
}());

const videoPlayer = (function makeVideoPlayer() {

  let player = null;

  const tag = document.createElement("script");
  tag.src = "https://www.youtube.com/iframe_api";
  const firstScriptTag = document.getElementsByTagName("script")[0];
  firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

  function onPlayerReady(event) {
    player = event.target;
    player.setVolume(100); // percent
  }

  let hasShuffled = false;

  function onPlayerStateChange(event) {
    player = event.target;
    const shufflePlaylist = true;

    if (!hasShuffled) {
      player.setShuffle(shufflePlaylist);
      player.playVideoAt(0);
      hasShuffled = true;
    }
  }


  function addPlayer(video) {

    const playlist = "0dgNc5S8cLI,mnfmQe8Mv1g,-Xgi_way56U,CHahce95B1g";
    const config = {
      height: 360,
      host: "https://www.youtube-nocookie.com",
      width: 640
    };
    config.playerVars = {
      autoplay: 0,
      cc_load_policy: 0,
      controls: 1,
      disablekb: 1,
      fs: 0,
      iv_load_policy: 3,
      loop: 1,
      playlist,
      rel: 0
    };
    config.events = {
      "onReady": onPlayerReady,
      "onStateChange": onPlayerStateChange
    };
    player = new YT.Player(video, config);

  }

  return {
    addPlayer
  };
}());

function onYouTubeIframeAPIReady() {
  const cover = document.querySelector(".playa");
  const wrapper = cover.parentElement;
  const frameContainer = wrapper.querySelector(".video");
  videoPlayer.addPlayer(frameContainer);
}
html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  background: #353198;
  animation: fade 2s ease 0s forwards;
}

@keyframes fade {
  0% {
    opacity: 0;
  }

  100% {
    opacity: 1;
  }
}

.outer {
  display: flex;
  min-height: 100%;
  box-sizing: border-box;
}

.tcell {
  display: flex;
  width: 100%;
  justify-content: center;
}

    .containera-inner{
    display: flex;
    flex: 1 0 0%;
     background-image:
     linear-gradient(teal 5px, #0000 5px),
     linear-gradient(90deg, teal 5px, #0000 5px),

     linear-gradient(black 10px, #0000 10px 160px, black 160px),
     linear-gradient(90deg, black 10px, #0000 10px 160px, black 160px),
  
     linear-gradient(orange 15px, #0000 15px 155px, orange 155px),
     linear-gradient(90deg, orange 15px, #0000 15px 155px, orange 155px),
     
     linear-gradient(black 20px, #0000 20px 150px, black 150px),
     linear-gradient(90deg, black 20px, #0000 20px 150px, black 150px),
     
     linear-gradient(teal 25px, #0000 25px 145px, teal 145px),
     linear-gradient(90deg, teal 25px, #0000 25px 145px, teal 145px),

     linear-gradient(black 30px, #0000 30px 140px, black 140px),
     linear-gradient(90deg, black 30px, #0000 30px 140px, black 140px),
 
     linear-gradient(orange 35px, #0000 35px 135px, orange 135px),
     linear-gradient(90deg, orange 35px, #0000 35px 135px, orange 135px),

     linear-gradient(black 40px, #0000 40px 130px, black 130px),
     linear-gradient(90deg, black 40px, #0000 40px 130px, black 130px),

     linear-gradient(teal 45px, #0000 45px 125px, teal 125px),
     linear-gradient(90deg, teal 45px, #0000 45px 125px, teal 125px),

     linear-gradient(black 50px, #0000 50px 120px, black 120px),
     linear-gradient(90deg, black 50px, #0000 50px 120px, black 120px),

     linear-gradient(orange 55px, #0000 55px 115px, orange 115px),
     linear-gradient(90deg, orange 55px, #0000 55px 115px, orange 115px),

     linear-gradient(black 60px, #0000 60px 110px, black 110px),
     linear-gradient(90deg, black 60px, #0000 60px 110px, black 110px),

     linear-gradient(teal 65px, #0000 65px 105px, teal 105px),
     linear-gradient(90deg, teal 65px, #0000 65px 105px, teal 105px),

     linear-gradient(black 70px, #0000 70px 100px, black 100px),
     linear-gradient(90deg, black 70px, #0000 70px 100px, black 100px),

     linear-gradient(orange 75px, #0000 75px 95px, orange 95px),
     linear-gradient(90deg, orange 75px, #0000 75px 95px, orange 95px),

     linear-gradient(black 80px, #0000 80px 90px, black 90px),
     linear-gradient(90deg, black 80px, #0000 80px 90px, black 90px),

     linear-gradient(teal, teal);
  animation: fade 5s ease  0s forwards;
   background-size: 165px 165px;
 
}

@keyframes fade {
  0% {
    opacity: 0;
  }

  100% {
    opacity: 1;
  }
}


.playa {
  margin: auto 20px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
 
}

.playa {
  fill: red;
  filter: drop-shadow(3px 3px 3px rgba(0, 0, 0, 0.7));
}



.video-wrapper {
  max-width: 640px;
  margin: auto;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

.ratio-keeper {
  position: absolute;
  top: 0;
  bottom: 0;
  height: 0;
  padding-top: 56.25%;
  width: 100%;
  margin: auto;
}

.video-frame {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.hide {
  display: none;
}
<div class="outer">

  <div class="tcell">
    <div class="containera hide">
      <div class="containera-inner">
        <div class="video-wrapper">
          <div class="ratio-keeper">
            <div class="wrapa">
              <div class="video video-frame"></div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <svg class="playa " width="100%" height="100%" viewBox="0 0 64 64">
      <path d="M25.6,46.4L44.8,32L25.6,17.6V46.4z M32,0C14.3,0,0,14.3,0,32s14.3,32,32,32s32-14.3,32-32S49.7,0,32,0z
      M32,57.6C17.9,57.6,6.4,46.1,6.4,32S17.9,6.4,32,6.4S57.6,17.9,57.6,32S46.1,57.6,32,57.6z" />
    </svg>
  </div>
</div>

2 Answers2

0

You need to give your flex items full width (flex: 1) and give the children full height (display: flex, which calls the default align-items: stretch).

Add this to your code:

.tcell {
   display: flex;
   /* width: 100%; */
   justify-content: center;
   flex: 1; /* new */
}

/* new */
.containera {
   flex: 1;
   display: flex;
}

Revised Fiddle

enter image description here

Michael Benjamin
  • 346,931
  • 104
  • 581
  • 701
  • It's not covering the whole area. https://i.imgur.com/SpbzzVk.png –  Aug 24 '21 at 03:16
  • Pull the top window down lower. –  Aug 24 '21 at 03:18
  • Not covering the whole area. https://i.imgur.com/Xfu9iWT.png //// https://jsitor.com/Cjy2AWTRWl –  Aug 24 '21 at 03:20
  • It's still not covering the whole area: Purple still visible. https://i.imgur.com/SpbzzVk.png –  Aug 24 '21 at 03:26
  • I see what you're saying. But that's an entirely different problem. See my answer here: https://stackoverflow.com/q/45497031/3597276 – Michael Benjamin Aug 24 '21 at 03:27
  • How is that issue fixed? https://i.imgur.com/ojw3lQT.png –  Aug 24 '21 at 03:28
  • Can you add what needs to be done to your answer? –  Aug 24 '21 at 03:29
  • This is from your revised fiddle: https://i.imgur.com/7AMVUXV.png ///// The purple background is still there. –  Aug 24 '21 at 03:30
  • The background is supposed to fill the entire area, not have the background cut off. –  Aug 24 '21 at 03:35
  • Of course. But like I said, that is a different problem. See the other post. – Michael Benjamin Aug 24 '21 at 03:38
  • The other post doesn't fix the issue. –  Aug 24 '21 at 03:39
  • Actually, the other post addresses this issue. If you want the background image to extend into the overflow area, you will need JavaScript. The task is currently beyond the capabilities of CSS. – Michael Benjamin Aug 24 '21 at 03:58
  • What would be added to the javascript? https://jsitor.com/Cjy2AWTRWl //// I think jsfiddle is down right now. –  Aug 24 '21 at 03:58
  • Again my friend, that is a separate question. This question has been answered. For that problem, you should post a new question (use the JavaScript and jQuery tags). – Michael Benjamin Aug 24 '21 at 03:59
  • How would it be fixed through the javascript? –  Aug 24 '21 at 04:00
  • Can you point me to the javascript answer? And I'll add it to the code. –  Aug 24 '21 at 04:01
  • What exactly am I having the javascript be able to do? –  Aug 24 '21 at 04:03
  • You posted a question to solve a problem. This question. It's been answered. The problem has been solved. Now there's an entirely different problem. Post another question to solve that one. That's the best path forward, in my view. Good luck. – Michael Benjamin Aug 24 '21 at 04:07
  • What am I asking for the javascript to do when I ask it in a question? –  Aug 24 '21 at 04:10
  • 1
    "How to get background image to cover overflow area" – Michael Benjamin Aug 24 '21 at 04:16
  • 1
    Use the other post as a reference to point out that CSS cannot solve the problem and that your question is not a duplicate. – Michael Benjamin Aug 24 '21 at 04:18
-2

You need to change a small part of your code align-items: stretch; align-content: stretch; and height: 100%;

.containera-inner{
    display: flex;
    flex: 100%;
    flex-direction: column;
    background-image:
     linear-gradient(teal 5px, #0000 5px),
     linear-gradient(90deg, teal 5px, #0000 5px),

     linear-gradient(black 10px, #0000 10px 160px, black 160px),
     linear-gradient(90deg, black 10px, #0000 10px 160px, black 160px),
  
     linear-gradient(orange 15px, #0000 15px 155px, orange 155px),
     linear-gradient(90deg, orange 15px, #0000 15px 155px, orange 155px),
     
     linear-gradient(black 20px, #0000 20px 150px, black 150px),
     linear-gradient(90deg, black 20px, #0000 20px 150px, black 150px),
     
     linear-gradient(teal 25px, #0000 25px 145px, teal 145px),
     linear-gradient(90deg, teal 25px, #0000 25px 145px, teal 145px),

     linear-gradient(black 30px, #0000 30px 140px, black 140px),
     linear-gradient(90deg, black 30px, #0000 30px 140px, black 140px),
 
     linear-gradient(orange 35px, #0000 35px 135px, orange 135px),
     linear-gradient(90deg, orange 35px, #0000 35px 135px, orange 135px),

     linear-gradient(black 40px, #0000 40px 130px, black 130px),
     linear-gradient(90deg, black 40px, #0000 40px 130px, black 130px),

     linear-gradient(teal 45px, #0000 45px 125px, teal 125px),
     linear-gradient(90deg, teal 45px, #0000 45px 125px, teal 125px),

     linear-gradient(black 50px, #0000 50px 120px, black 120px),
     linear-gradient(90deg, black 50px, #0000 50px 120px, black 120px),

     linear-gradient(orange 55px, #0000 55px 115px, orange 115px),
     linear-gradient(90deg, orange 55px, #0000 55px 115px, orange 115px),

     linear-gradient(black 60px, #0000 60px 110px, black 110px),
     linear-gradient(90deg, black 60px, #0000 60px 110px, black 110px),

     linear-gradient(teal 65px, #0000 65px 105px, teal 105px),
     linear-gradient(90deg, teal 65px, #0000 65px 105px, teal 105px),

     linear-gradient(black 70px, #0000 70px 100px, black 100px),
     linear-gradient(90deg, black 70px, #0000 70px 100px, black 100px),

     linear-gradient(orange 75px, #0000 75px 95px, orange 95px),
     linear-gradient(90deg, orange 75px, #0000 75px 95px, orange 95px),

     linear-gradient(black 80px, #0000 80px 90px, black 90px),
     linear-gradient(90deg, black 80px, #0000 80px 90px, black 90px),

     linear-gradient(teal, teal) !important;
   animation: fade 5s ease  0s forwards;
   background-size: 165px 165px;
   width: 1000px;
   align-items: stretch;
   align-content: stretch;
   height: 100%;
}

output