Jump to content

Showing an item dependent on the focus of another


Recommended Posts


Can you use 'a' and 'a :focus' as conditional to hide/show another element?

The following doesn't seem to work. Is it likely to with some re-working, or is this a no-no?

a + span{display: none;}
a:focus + span{display: block;}
<a>Anchor</a><span><input  /></span>


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...