Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show content when hovering over DIV

Is it possible to show content when hovering over the DIV. See Image

When I hover over the div, the transition takes place, but is it possible to show content inside the hovering div, ie. Images etc

html :

<div class="flowingdown">

</div>

CSS3 :

.flowingdown {
    width:1045px;
    background-image:url(images/vertical_cloth.png);
    height:50px;
    float:left;
    margin-top:2px;
    margin-bottom:2px;
    border-radius:0 0  55px 55px ;
    transition: height 1s;
    -webkit-transition: height 1s;


}

.flowingdown:hover {
    height:100px;
}
like image 409
Farhan Afzal Avatar asked Jul 25 '13 13:07

Farhan Afzal


People also ask

How do I show text on mouseover?

HTML: Use a container element (like <div>) and add the "tooltip" class to it. When the user mouse over this <div>, it will show the tooltip text. The tooltip text is placed inside an inline element (like <span>) with class="tooltiptext" .

How do you make a div appear when hover over another div?

We can apply an adjacent sibling CSS selector property to the <a> tag that will display the hidden div element's content while hovering over it. The Adjacent sibling selector is a CSS Combinators, used to select the element that is adjacent or the element that is next to the specified selector tag.

How do you add hovering text in HTML?

We now have our link. to add mouseover text, just use the "title" attribute, like so: <a href=" " title="This is some text I want to display. ">This link has mouseover text. </a> (see the next line to check this out in action.) This link has mouseover text.


2 Answers

Assume you have the following markup:

<div id="parent">
    Some content
    <div id="hover-content">
        Only show this when hovering parent
    </div>
</div>

The CSS:

#hover-content {
    display:none;
}
#parent:hover #hover-content {
    display:block;
}

This should do the trick.

Not sure how you'd do it with transitions, but you'd have to put the same selector at least.

Example

like image 125
Anpan Avatar answered Nov 15 '22 15:11

Anpan


If, per say, you have this context :

<div class="flowingdown">
    <div class="something-inside">
        something-inside
    </div>
    <div class="something-inside-but-hidden">
        something-inside-but-hidden
    </div>
</div>

CSS

.something-inside-but-hidden {display:none}
.flowingdown:hover .something-inside-but-hidden {display:block}

Working example jsFiddled here

like image 40
Milche Patern Avatar answered Nov 15 '22 14:11

Milche Patern