【发布时间】:2023-03-05 23:18:01
【问题描述】:
我在我的项目中使用 Bootstrap 并尝试在移动设备上查看时调整 iframe 的大小。问题在于它将@media (max-width:600px) 中的属性应用于站点的桌面版本,并且看起来被压扁了。 Width 可以正常工作,但 height-auto 属性在桌面屏幕上显示效果不佳。
HTML:
<iframe src="./bootstrap-remake_files/9m056zu9yr.html" allowtransparency="true" frameborder="0" scrolling="no" class="wistia_embed" name="wistia_embed" allowfullscreen="allowfullscreen" mozallowfullscreen="mozallowfullscreen" webkitallowfullscreen="webkitallowfullscreen" oallowfullscreen="oallowfullscreen" msallowfullscreen="msallowfullscreen" style="width: 768px; height: 432px;" width="768" height="432" mytubeid="mytube1"></iframe>
CSS:
@media (max-width:600px){
iframe{
width:100%;
height:auto;
}
}
换句话说,我希望我的 iframe 有
width:100%;
height:auto;
仅在移动设备上。
【问题讨论】:
-
结尾的
}不见了? -
在实际代码中。粘贴时错过了。