-ms-overflow-style on iframe

-ms-overflow-style on iframes

我有一个以 iframe 作为主要内容区域的网站。当我应用下面的 css 它会按预期运行并从页面中删除滚动条。

html{
    -ms-overflow-style: none;
}

但我希望 iframe 本身允许滚动条,所以我使用下面的更具体的规则覆盖上面的内容。

iframe{
    -ms-overflow-style: scrollbar;
}

当使用开发人员工具检查元素时,您可以清楚地看到样式已就位,但没有按应有的方式运行,滚动条仍然不存在。这是一个错误还是我遗漏了什么?

Example

从图片上看,我想删除页面滚动条,但 iframe 滚动条仍然完好无损。

html, body {
    position:relative;
    height:100%
}
İframe {
    position:absolute;
    top:0;
    left:0;
    width:100%;
    height:100%
}

正如@Alohci 所提到的,我确实需要在 iframe 调用的文档中而不是在父文档中设置它。

父/母版页:

html,
body {
  -ms-overflow-style: none;
}

iframe 调用的子/文档:

body {
  -ms-overflow-style: scrollbar;
}

可能是因为你的页面太宽了,垂直滚动条是水平滚动条造成的。

尝试搜索是什么让您的页面比需要的大,然后 window 滚动条应该会消失。