CSS 跨浏览器“光标:指针”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2076468/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 21:28:05  来源:igfitidea点击:

Cross-browser 'cursor:pointer'

css

提问by ripper234

I found these CSS attributes, that make the cursor look like a hand:

发现这些 CSS 属性使光标看起来像一只手:

  • IE- style="cursor: hand;"
  • NS6/ IE6- style="cursor: pointer;"
  • Cross Browser- style="cursor: pointer; cursor: hand;"
  • IE- 样式 =“光标:手;”
  • NS6/ IE6- style="cursor: pointer;"
  • 跨浏览器- style="cursor: pointer; cursor: hand;"

However I notice that Stack Overflow is using "cursor: pointer" in its CSS. However, this apparently work also on IE.

但是我注意到 Stack Overflow 在其 CSS 中使用了“cursor:pointer”。但是,这显然也适用于 IE。

So ... what gives? What is the correct, browser-independent way to use this CSS item?

那么......什么给?使用此 CSS 项的正确的、独立于浏览器的方式是什么?

回答by Kaleb Brasee

According to Quirksmode, the only cross-browser syntax is:

根据Quirksmode,唯一的跨浏览器语法是:

element {
    cursor: pointer;
    cursor: hand;
}

They give some more information about the cursor as well:

他们还提供了有关光标的更多信息:

In the past the hand value was Microsoft's way of saying pointer; and IE 5.0 and 5.5 only support hand. Because it's the cursor value that's used most often, most other browsers have also implemented hand.

Since IE 6 and 7 support pointer, there's no more reason to use hand, except when older IEs are part of your target audience.

过去,手的价值是微软说指针的方式;并且IE 5.0 和5.5 只支持hand。因为它是最常使用的光标值,所以大多数其他浏览器也实现了hand。

由于 IE 6 和 7 支持指针,没有更多理由使用手动,除非旧 IE 是您的目标受众的一部分。

I think the page you linked to might be a little outdated with the newest browsers.

我认为您链接到的页面在最新的浏览器中可能有点过时。

回答by Sampson

I've only ever used cursor:pointermyself, and have noticed no lack of support in major browsers.

我只使用过cursor:pointer自己,并且注意到在主要浏览器中不乏支持。