我有this jsfiddle,我在桌子的顶部放了一个“ cursor” div。一个函数通过操纵CSS属性left
,top
,width
和height
来移动光标。
在Chrome 24和MSIE 9.0中,光标完全覆盖了单元格的红色边框,并且在单元格外部延伸了一个像素(因此,光标在单元格的边界上方绘制并泄漏到所有相邻的单元格中,而不会泄漏到单元格中)。
在Firefox 19.0中,光标向下/向左移动一个像素。
如何为大多数浏览器修复代码?
最佳答案
@-moz-document url-prefix() {
#cursor {
margin-left:-1px !important;
margin-top:-1px !important;
}
}
在您的jsfiddle中进行了测试
在Opera(如果需要)中修复用户这样的黑客:
@media all and (-webkit-min-device-pixel-ratio:10000), not all and (-webkit-min-device-pixel-ratio:0) {
#cursor {
property:value;
}
}
希望对您有所帮助