1

How to show a child div when hovering anchor tag? I want to show a div with class botm when cursor hovers anchor tag. This is the exact scheme I am using so kindly keep tags in the same order:

HTML:

<a> Hover me!</a>
<div class="faraz"> sdjfg 
<div class="dikha">Stuff shown on hover</div>
<div class="botm"></div>
</div>

CSS:

div {
display: none;
}

a:hover ~ .faraz > .botm {
display: block;
background-color: RED;
height: 250px;
width: 960px;
}
.botm {
background-color: #0CC;
height: 50px;
width: 100%;
position: fixed;
top: 90px;
}

1 Answer 1

3

The parent of your targeted div is hidden therefore it cannot be shown. Show the parent as well and every thing will work.

a:hover ~ .faraz{
    display:block;
}

http://jsfiddle.net/r2Zyp/

Sign up to request clarification or add additional context in comments.

2 Comments

Perfecto...THANKS i wish my reputation is atleast 15 so i can give u +
please have a look at this code jsfiddle.net/farazi482/r2Zyp/2 i want to show menuDropDOWN class div only when i hover list items under links class div

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.