Youtube embedded video looks weird on mobile

153 views Asked by At

enter image description hereMy YouTube videos on my website look weird on mobile, I have tried to change the width and height of each of them and still have the same issue.

HTML CODE

<div class="playing-cards">

    <iframe width="611" height="450" src="https://www.youtube.com/embed/7qjkrDsgvO8" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
  
  <div class="closr">
  
  <iframe width="611" height="450" src="https://www.youtube.com/embed/_PupZlKYYCU" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
    
  </div>

**CSS CODE**

}

.playing-cards{
    text-align: center;
    height: 560px;
    width: 315px;
    position: absolute;
    top: 107%; right: 0%;
    bottom: 50%; left: 30%;
    
}

.closr{
   text-align: center;
    height: 560px;
    width: 315px;
    position: absolute;
    top: 185%; right: 0%;
    bottom: 40%; left: 30%;
    
}
1

There are 1 answers

2
Samson Orr On

You should change it to:

<iframe width="315" height="560" src="https://www.youtube.com/embed/7qjkrDsgvO8" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
So it resizes to 315x560.