CSS div that appears when hovering on anchor; keeping it visible while hovering over div

enano2054

I have a div that I want to pop up when I hover over the link before it. The hover works great, but there is a link inside the div that appears that I want people to be able to click but it disappears when I try to go to it.

Here is the jsfiddle

I am trying to use just CSS here but if I need any jquery or anything then cool.

#soldoutinfo a {                                        
    padding:4px 2px;
    font-size:10px;
}

#soldoutinfo, .soldout {                                        
    display:inline;
}

#soldoutinfo a {                                    
    color:#cc0000;
}

#soldoutinfo a:visited {                            
    color:#cc0000;
}

#soldoutinfo + div {                                    
    display:none;
    width:0;
    height:0;
    position:absolute;
}

#soldoutinfo:hover + div {                          
    display:block;
    height:60px;
    width:250px;
    background:#ffffff;
    box-shadow: 0 0 4px #888888;
    position: absolute;
    padding: 8px;
    top: 19px;
    left:12px;
    z-index:1000;
}

#soldoutinfo + div p {                          
    font-size:12px;
}

<p id="soldoutinfo">
    <sup><a>?</a></sup>
</p>
<div>
<p>Hope is not lost! <a href="#">Send us a message</a> and we will see if our stores have any in stock to ship to you.
</p>
</div>
LinkinTED

The problem is that the hover effect is on the element after the anchor. So when you leave the anchor, your hover effect will end to.

You could fix it like this, although it's not the cleanest solution: Set your tooltip inside your anchor, using a span

<p id="soldoutinfo">
    <sup><a>?</a></sup>
    <span>Hope is not lost! <a href="#">Send us a message</a> and we will see if our stores have any in stock to ship to you.</span>
</p>
#soldoutinfo span {                                 
    display:none;
    width:0;
    height:0;
    position:absolute;
}

#soldoutinfo:hover span {                           
    display:block;
    height:60px;
    width:250px;
    background:#ffffff;
    box-shadow: 0 0 4px #888888;
    position: absolute;
    padding: 8px;
    top: 19px;
    left:12px;
    z-index:1000;
}

JSFiddle DEMO

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

position: absolute; only visible when hovering over the div

How to trigger div visibility when hovering over list item in CSS?

Displaying button when hovering over div in TailwindCSS

Changing divs when hovering over a different div

CSS hovering with in a child div

CSS - Keep submenu visible while hovering over either main or submenu

How to set height of child div while hovering over a parent div in css?

CSS objects in div move when hovering

Affect another div when hovering CSS

Internet Explorer growing div when hovering anchor with inline-block

Is there a way to change a target div's text when hovering over other div's using css only?

Hovering over divs not affecting div

How to display a div when hovering over another div

Change the Brightness of a div when hovering over another div

Keep UL visible when hovering from div to UL

Hovering on Div

Display DIV when hovering another DIV's child CSS

Add animation after hovering over a div with CSS transform scale

How to display a div when hovering over an image using CSS/HTML + Transitions?

Changing the style of one div when hovering over another

swap image when hovering over its container div

Change color of icon when hovering over div in which it is contained

Chrome fixed div disappearing when hovering over links

Multiple images depending on mouse location when hovering over div

How to scroll up a div when hovering over another element

Getting 2 divs to change colour when hovering over 1 div

Changing background of main div when hovering over subdiv

Expand image only when hovering over containing div

Image disappears when hovering then appears - CSS

TOP Ranking

HotTag

Archive