Click here to Skip to main content
15,878,871 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
hello friends,
please have a look on below code

<body topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<div class="mainHolder">
	<div class="loginHolder ">
		<ul>
			<li>Name:</li>
			<li><input type="text" /></li>
			<li>Pwd:</li>
              <li><input type="text" /></li>					 
		</ul>			 
	</div>
	<div class="caption">
		<h5>Login</h5>
	</div>
</div>
</body>


I'm not able to do CSS3 display div.loginHolder when I hover on div.caption
I have tried following CSS
<style type="text/css">
      .caption:hover + .loginHolder
		   {
			  display:block;
		   }
</style>


Any idea where I'm going wrong

Thanks in advance
Posted
Updated 12-Mar-12 2:05am
v2

1 solution

Well, the specification says that a selector of "a + b" means "a" immediately followed by "b". (Specification here[^])

In your source, your .loginHolder div is before the .caption div, so they are the wrong way around for the selector to work.
 
Share this answer
 
Comments
dhage.prashant01 12-Mar-12 11:49am    
ok so how can i display .loginHolder when mouse hover on .caption
Any idea??
Graham Breach 12-Mar-12 11:54am    
If you swapped the order of your divs, then the login div would appear when you hover over the caption. But it would only appear when the mouse was over the caption, not when you try to move the mouse over the login div.

If you put the login div inside the caption div, then change the CSS selector to .caption:hover .loginHolder without the "+", it should work.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900