swo*_*ish 12 html css node-webkit nw.js
我在html/css/js桌面应用程序中使用nw.js,并且无法在全屏模式下完全删除鼠标光标.
我已经通过设置CSS属性删除它cursor: none,margin: 0,padding: 0对身体/ HTML.而且还toolbar: false与fullscreen: true在的package.json设置.但是光标在屏幕的所有边缘都可见几个像素(图片如下).
奇怪的行为,有人知道如何彻底删除它吗?
注意:这只是NW.js中的一个问题,因为它在所有浏览器和xulrunner中都能很好地工作,因为我们在公司中从xulrunner迁移到node-webkit(nw.js)所有应用程序都遇到了这个问题.
我怀疑另一个元素正在应用cursor:auto,本质上覆盖了你的CSS规则。
考虑以下基本示例:
html, body {
background:#000; color:#FFF;
padding: 0; margin: 0;
text-align: center;
cursor:none;
}
div {
margin:2em;
padding:1em;
background:#555;
cursor:auto;
}Run Code Online (Sandbox Code Playgroud)
<div>
<p>This div has cursor:auto</p>
</div>Run Code Online (Sandbox Code Playgroud)
正如您所看到的,该元素获得正常的光标,因为它有一个cursor:auto规则。由于您没有提供代码,我无法确切知道哪个元素正在获取规则,您可以在开发工具中检查以捕获它。否则,您可以使用以下 CSS 行覆盖所有光标规则:
* { cursor: none !important; }
Run Code Online (Sandbox Code Playgroud)
看看它的实际效果:
* { cursor: none !important; }
Run Code Online (Sandbox Code Playgroud)
html, body {
background:#000; color:#FFF;
padding: 0; margin: 0;
text-align: center;
cursor:none;
}
div {
margin:2em;
padding:1em;
background:#555;
cursor:auto;
}
* { cursor: none !important; }Run Code Online (Sandbox Code Playgroud)
编辑:iframe
光标无法隐藏在通过iframe. 需要iframe在本地获取 CSS 规则。
请参阅 iframe 演示:https://jsfiddle.net/azizn/rr7bsrc7/1/