How to manipulate the iframe css based on device size

后端 未结 1 860
没有蜡笔的小新
没有蜡笔的小新 2021-01-27 11:26

I\'m building this site and I\'m having trouble manipulating the iframe based on size of the device. Basically, what I want is if the use is on a tablet the video is one size bu

1条回答
  •  心在旅途
    2021-01-27 11:55

    Try this:

    .embed-container {
       position: relative;
       width: 100%;
       height: 0;
       padding-bottom: 56.27198%;
     background-size: cover;
     background-repeat: no-repeat;
       background-position: center center;
     }
    
    .embed-container iframe {
     position: absolute;
       top: 0;
       left: 0;
       width: 100%;
       height: 100%
     }

    more detail

    0 讨论(0)
提交回复
热议问题