CSS3 :hover 和 :focus 之间的区别?

发布于 2024-11-09 22:55:22 字数 172 浏览 3 评论 0原文

CSS3 文档 谈论 :hover 和 :focus,这对我来说似乎完全相同。两者有何区别?我没看到什么?

谢谢!

The CSS3 doc talks about :hover and :focus, which seem exactly the same to me. What are the differences between the two? What am I not seeing?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

橙幽之幻 2024-11-16 22:55:22

当鼠标指针位于元素上方时,悬停为“true”。如果光标位于该元素中,则焦点为 true。悬停可能为假而焦点为真(例如,单击文本字段然后将鼠标移开)

Hover is 'true' when the mouse pointer is over an element. Focus is true if the cursor is in that element. It's possible for hover to be false and focus true (e.g click in a text field then move the mouse away)

明天过后 2024-11-16 22:55:22

:hover 适用于鼠标光标当前位于其上的任何元素。 :focus 指表单焦点,是当前获得焦点的表单元素。粗略地说,如果您开始打字,您将填写哪个元素?

:hover applies to any element that the mouse cursor is currently over. :focus refers to form focus, and is the current form element with focus. Roughly speaking, if you start typing, which element will you be filling?

往日 2024-11-16 22:55:22

:hover:focus 之间的区别是:

当鼠标指针位于元素上时,:hover

:focus 当您选择一个元素时,该元素就会进入焦点。

更多信息:W3Schools 的 CSS 伪类

The different between :hover and :focus is:

:hover when your mouse pointer is on the element.

:focus when you select an element, the element gets into the focus.

More Information: CSS Pseudo Classes at W3Schools

毁梦 2024-11-16 22:55:22

悬停仅当指针设备位于元素上方时适用。医生说得很清楚。

hover only applies when the pointing device is over the element. The doc makes that quite clear.

巾帼英雄 2024-11-16 22:55:22

将鼠标悬停在鼠标上,您可以使用新的 css3 技术添加 % 百分比和过渡时间。预计IE9以后所有主流浏览器都会支持它们。
这里有两个导航菜单的一些示例,用于了解悬停和悬停动画以及 css3悬停属性中颜色的淡入淡出。
`

Hover you can add with % percentages with transition timing with the new css3 technology. Expect IE9 all major browsers will support them.
here are some samples of two navigation menus to understand hover and animation on hover and also the fading of the colors in css3 hover attribute.
`

薄凉少年不暖心 2024-11-16 22:55:22

悬停尤其与鼠标指针有关:

当鼠标指针悬停/(在按钮上)时的示例 按钮对于该按钮悬停true

焦点是关于突出显示元素的:

通常当我们使用tab键来改变元素的焦点时。

Hover is particularly about Mouse Pointer:

Example when Mouser pointer is over / (on the) Button, for that button hover is true.

Focus is about the highlighting element:

Usually when we use tab key to change the focus of an element.

心安伴我暖 2024-11-16 22:55:22

两者之间存在“对比差异”:

悬停-当鼠标指针悬停(波浪或浮动) 在特定元素上。

焦点 - 当您选择一个元素时,该元素将获得焦点。

There is a "contrasting difference" between the two:

Hover-When your mouse pointer hover(wave or float) over a particular element.

and

Focus-When you select an element,then the element gets into focus.

哆兒滾 2024-11-16 22:55:22

悬停和焦点这两件事之间的主要区别是:

悬停:- 当您将鼠标指针放在特定元素(例如按钮、文本字段等)上时。

焦点:- 当您选择一个元素或单击某个事件时到时候它就会改变原来的状态,看起来就不一样了。

The main difference between these two things i.e. hover and the focus is:

hover:- when you take your mouse pointer is on the particular element such as button, text-field etc.

focus:- when you select an element or click an event that time it changes its original state and looks different.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文