【问题标题】:Resizing a iframe using @media rules [closed]使用@media 规则调整 iframe 的大小 [关闭]
【发布时间】:2021-06-28 14:43:39
【问题描述】:

我正在尝试使用媒体查询调整 cbox iframe 的大小,以便在较小的屏幕使用时调整大小。它似乎不起作用,所以任何帮助将不胜感激。谢谢!

HTML:

<div id="n-cbox"><iframe id="iframe-cbox" src="URL removed on purpose" height="404" allowtransparency="yes" allow="autoplay" frameborder="0" marginheight="0" marginwidth="0" scrolling="auto"></iframe></div>

CSS:

#n-cbox {
    position: fixed;
    display: none;
    z-index: 999;
    top: 218px;
    left: auto;
    right: 50px;
    bottom: auto;
    width: nullpx;
    padding: 0px;
}
        

#iframe-cbox {
    width:100%;
}

@media only screen and (max-width:800px) {

    #iframe-cbox {
        width:50%;
    }

【问题讨论】:

标签: html css iframe media-queries


【解决方案1】:
@media only screen and (max-width:800px) {

    #iframe-cbox {
        width:50% !important;
    }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-01-04
    • 2012-11-16
    • 1970-01-01
    • 1970-01-01
    • 2019-09-27
    • 1970-01-01
    • 2014-06-04
    • 2010-11-17
    相关资源
    最近更新 更多