html - 关于 iframe 和水平滚动的另一个问题

标签 html css reactjs iframe sass

在我的 React 应用程序中,我使用的是 iframe,其内容由服务器提供。没有在样式中添加任何关于 overflow 的内容,我只在 Chrome 中看到了水平滚动条(没有可拖动的滚动条,只有滚动条),而在 FireFox 和 Edge 等其他浏览器中没有。

添加overflow-x: hidden; I frame样式的wrapper div是这样的

.article-container {
  display: flex;
  flex-direction: column;
  flex: auto;
  iframe {
    flex: auto;
    overflow-x: hidden;
  }
  iframe.body {
    overflow-x: hidden;
  }
}

从 CSS 文件添加 overflow-x: hidden; nighter 或作为内联样式添加到 iframe 都不起作用,仍然可以看到滚动条(在 chrome 中) 我知道 iframe 的内容不可从外部操作,以防万一我添加了 iframe.body

所以我的问题是,为什么只能在 Chrome 中看到它,有没有办法隐藏 X 轴滚动? 与Flex和方向有关吗?

My main question is why it only happens in Chrome, and what is the difference in render or browser engine that makes such a difference. wrapping the iframe in a div with a lesser height is not an answer, it is a hack

最佳答案

可以在iframe标签中加入scrolling="no"

<iframe src="your path" scrolling="no"></iframe>

关于html - 关于 iframe 和水平滚动的另一个问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55531721/

相关文章:

reactjs - ESlint:解析错误:意外的 token <

javascript - 是否可以将 css 应用于 Canvas 标签中的文本

html - css 媒体宽度规则

css - 关键帧旋转没有进行

css - 如何让这个 DIV 显示在这个页面所有内容的下方?

reactjs - 在 React Dropzone 中获取本地文件路径

javascript - 我怎样才能向右滑动一个div,让它看起来像从div后面滑出来

Javascript:通过浏览器显示每个功能所需的时间

html - CSS/Javascript 如何像在 IE7+ 中那样在 Firefox 中制作这个背景位置影片?

javascript - React - 将组件动态加载到页面中