开发者

css pseudoclass:hover not working

开发者 https://www.devze.com 2023-01-18 07:04 出处:网络
I am struggling to get a simplest css hover pseudoclass to work. Anybody knows why the following doesnt wo开发者_开发问答rk?

I am struggling to get a simplest css hover pseudoclass to work. Anybody knows why the following doesnt wo开发者_开发问答rk?

the css

#hidden {display:none;}
#show:hover #hidden{display:block;}

the html

<a href="#" id="show">show</a>
<div id="hidden">here i am</div>

I really feel stupid asking such a simple question, i did this a hunderd times, but cant figure out why this shouldnt work.


Try this

#show:hover + #hidden{display:block;}

:hover #hidden implies that #hidden is a child of the hover element. The + selector looks for the next adjacent sibling.

0

精彩评论

暂无评论...
验证码 换一张
取 消