强制网页光标
根据 w3schools
光标属性指定类型 时显示的光标 指向一个元素。
但是,我发现在使用使用 iframe 的富文本编辑器时,某些浏览器下不会显示元素光标。 Firefox/Chrome/Safari/Konqueror 可以工作,但 IE/Opera 不行。
在这种情况下,有没有办法在所有浏览器上可靠地设置光标?例如,一种独立于指向哪个元素来设置光标的方法。
编辑: 光标样式设置在 iframe 内的元素上。除了 IE/Opera 似乎无法在 iframe 中正确检测悬停事件之外,此方法有效。
According to w3schools
The cursor property specifies the type
of cursor to be displayed when
pointing on an element.
However I found an elements cursor is not shown under certain browsers when working with a rich text editor, which uses an iframe. Firefox/Chrome/Safari/Konqueror work but IE/Opera do not.
Is there a way to reliably set the cursor in this case across all browsers? For example a way to set the cursor independent of which element is pointed at.
Edit:
the cursor style is set on elements within the iframe. This works except that IE/Opera can't seem to detect hover events properly within the iframe.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
也许这样的东西会在您的样式表中起作用:
我还怀疑您可能必须在文本编辑器框架的样式中应用这样的规则。您应该阅读编辑器的文档以获取有关如何操作的说明。
Maybe something like this would work in your stylesheet:
I also suspect you might have to apply a rule like this within the style of the text editor's frame. You should read the documentation of the editor for instructions on how to do it.
鉴于所见即所得编辑器使用
并且
是其自己的文档,因此您的 CSS 不会应用于
。
当您使用
时,生成的 DOM 结构看起来有点像这样......
并且
outer.css
中定义的规则不适用于的内容和
inner.css
的内容不适用于外部文档。Given that the WYSIWYG editor uses an
<iframe>
and an<iframe>
is its own document, your CSS won't doesn't apply to the contents of the<iframe>
.When you use an
<iframe>
the resulting DOM structure looks a little like this...... and the rules defined in
outer.css
don't apply to the contents of the<iframe>
, and the contents ofinner.css
don't apply to the outer document.