仅更改 iframe 的滚动条样式
我只想更改 iframe 滚动条的样式,而不是 window 滚动条的样式。我见过webkit和body css的样式,但是这些改变了窗口滚动条的样式。有没有可能的方法让 iframe 中的滚动条与父窗口不同。
I want to change the style of scrollbars of iframe only, not the style of scrollbars of window. I've seen the style of webkit and body css, but these change the style of window scrollbars. Is there any possible way to have different scrollbar in iframe than the parent window.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
佩卡的评论是准确的。然而,有些浏览器实际上是在 iframe 所在的页面中“创建”滚动条,因此您需要使用 iframe 的 ID,并设置如下样式:
然而,大多数浏览器让页面创建滚动条你正在使用 iframe,在这种情况下,你需要在该页面中为它们指定 CSS 样式,就像 Pekka 所说的那样。
关键在于哪个页面负责在需要时“制作”滚动条。
希望这有帮助。
What Pekka commented is accurate. However, some browsers actually "creates" the scrollbars in the page where you have the iframe in, so there you need to use an ID for the iframe, and set the styles like:
However, most browsers let the scrollbars be created by the page you are iframing, in which case you need to specify the CSS styles for them within that page, like Pekka said.
It's all about which page is responsible for "making" the scrollbars when they are needed.
Hopefully that helps.