Using :focus pseudo class on li or other element else than a,input,button, etc?

That's simple: just add a tabindex attribute to the elements which normally don't receive focus.

Up vote 2 down vote favorite share g+ share fb share tw.

I am trying to modify height of a li element when it's focused, tried with a, but the height won't change. Sincerely, s4nji Requested Info : "Can you also explain how do you put focus on LI? " I did it like this, jsfiddle.net/s4nji/Rjqy5/ css css-selectors pseudo-class link|improve this question edited Dec 25 '11 at 22:11BoltClock's a Unicorn?102k14146379 asked Dec 23 '11 at 10:20s4nji575 100% accept rate.

All you've provided is a set of LI elements an a link that can get focused. And CSS settings for focused elements. That's why I asked you, how you got focus on LI element?

I suppose the only way is to put an anchor tag inside your LI to make it focusable... not LI directly of course... – Robert Koritnik Dec 23 '11 at 13:03.

Ooooohhh, It worked like a magic XD Thanks a lot XD – s4nji Dec 23 '11 at 22:03 I tried exactly that on his JSFiddle because it crossed my mind that could make it focusable... Didn't seem to work... – Robert Koritnik Dec 24 '11 at 20:12.

You can't focus list items. Not even using a script. I've tried doing $("li:first").focus() but it doesn't do anything.

CSS doesn't get set as if it was focussed. This simply means that you either can't focus list items or that :focus pseudo classes don't work on list items. Put anchors inside list items ... ... ... ... This will seemingly focus your list item but it will actually focus anchor tags.

I am trying to modify height by focusing ( clicking ) on the li elements. I tried with a, but the height won't change. – s4nji Dec 23 '11 at 22:01.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions