CSS scale height to match width - possibly with a formfactor

前端 未结 10 1783
天涯浪人
天涯浪人 2020-12-04 11:28

I have implemented a GoogleMapsV3 map in a twitterBootstrap basic responsive design site.

But my question is quite simple: i have:

10条回答
  •  不知归路
    2020-12-04 11:40

    .video {
        width: 100%;
        position: relative;
        padding-bottom: 56.25%; /* ratio 16/9 */
    }
    
    .video iframe {
        border: none;
        position: absolute;
        width: 100%;
        height: 100%;
    }
    

    16:9

    padding-bottom = 9/16 * 100 = 56.25

提交回复
热议问题