Iframe width and Height values



我已经直接从网站上复制了关于我的iframe的代码,该代码直接放在我的代码中。然而,当创建一个类iframe时,它似乎不会从CSS上创建的类中读取值,但当我将其直接粘贴到代码中时,它会从附带的代码中获得自己的大小。如何重新调整Iframe的大小,使其可以直接从类(CSS)中准备好。。我已经删除并删除了高度和宽度,并从其类中设置了大小,它不做的更改

这是我的iframe代码

      <div class="iframe">
            <iframe src="https://sway.com/s/3HuzZFFkT18WUe4M/embed" width="100%" marginwidth="0" height="100px" marginheight="0" scrolling="no" frameborder="no" class="iframee" style="border: none; max-width:100%; max-height:100vh" allowfullscreen webkitallowfullscreen
mozallowfullscreen msallowfullscreen></iframe>
  </div>

我的CSS-这个宽度和高度对代码没有影响

.iframe {
    height: 100px;
    width: 600px;
    margin-left:auto;
    margin-right:auto;
    }

您正在使用css类对外部div进行样式更改,但iframe标记的样式保持不变。你可以把css放在iframe标签上,比如:

    iframe
    {
        max-height: 200vh;
        height:200px;
    }

最新更新