使用:聚焦伪类对li或除a,输入,按钮等之外的其他元素 [英] using :focus pseudo class on li or other element else than a,input,button, etc
问题描述
是否可以选择一个聚焦的元素,如:focus或input:focus,而另一个元素,如div,li,span或else?
如果不可能,如何替换标签?
我试图修改li元素的高度,当它集中,尝试a,但高度不会改变。
请求的信息:
你也可以解释一下如何把重点放在LI上?
通过css选择器 li:focus
。请参阅 https://jsfiddle.net/s4nji/Rjqy5/ 。
这很简单:只需向通常不接收焦点的元素添加 tabindex
属性。 / p>
Is it possible to select an element that is focused, like a:focus or input:focus, but on the other element, such as div, li, span or else?
If it's not possible, how can it be substituted with a tag? I am trying to modify height of a li element when it's focused, tried with a, but the height won't change.
Requested Info :
"Can you also explain how do you put focus on LI?"
Via css selector li:focus
. See https://jsfiddle.net/s4nji/Rjqy5/.
That's simple: just add a tabindex
attribute to the elements which normally don't receive focus.
这篇关于使用:聚焦伪类对li或除a,输入,按钮等之外的其他元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!