Link to home
Start Free TrialLog in
Avatar of damianb123
damianb123Flag for United Kingdom of Great Britain and Northern Ireland

asked on

Trying to bottom align a hover over tooltip span window

Hi,
    I am using a simple hover over tooltip, which works very well, the trouble I have is, if the hover over is near the bottom of the page, it often drags the hover window off the bottom.....  What I want to do is align the bottom of the hover window to the bottom of the div, resulting in it always showing.  This is the CSS code to make the hover over tooltip appear:

<style type="text/css">

		.tooltip {
			border-bottom: 1px dotted #000000; color: #000000; outline: none;
			cursor: help; text-decoration: none;
			position: relative;
			
		}

		.tooltip span {
			margin-left: -999em;
			position: absolute;
margin-top:-75px; 
		}
		
		.tooltip:hover span {
			border-radius: 5px 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; 
			box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.1); -webkit-box-shadow: 5px 5px rgba(0, 0, 0, 0.1); -moz-box-shadow: 5px 5px rgba(0, 0, 0, 0.1);
			font-family: Arial, Tahoma, Geneva, sans-serif;
			display:inline; position:absolute; color:#fff;
			vertical-align: bottom; margin-left: -20px; width: 400px;
		}

		.tooltip:hover em {
			font-family: Candara, Tahoma, Geneva, sans-serif; font-size: 1.2em; font-weight: bold;
			display: block; padding: 0.2em 0 0.6em 0;
		}

		
		p {
    margin-top: 0;
}


		.custom { padding: 0.5em 0.8em 0.8em 2em; }


		* html a:hover { background: transparent; }


		.help { background: #000; border: 2px solid #FFF;	}

		.info { background: #000; border: 2px solid #FFF;	}


}



		</style>

Open in new window


I have attached a file to show how it currently looks.
ee-img1.png
Avatar of Robert Granlund
Robert Granlund
Flag of United States of America image

In tooltip span or tooltip or tool tiphover try something like: bottom:-100px;  see what happens.  One of those three css entries will control the position of the tooltip. the bottom -100px will show a dramatic change in the positon.  From that, you can adjust the bottom: to suit your needs.

It would help if there was a url.
Avatar of damianb123

ASKER

Hi,
     It appears to be the .tooltip hover span which controls the position, and you are correct that adding a margin bottom does adjust the box, however there are approx 50 hover overs all pulled from the database, each with varying info within, so the size of the hover box changes greatly.  I added this, vertical-align: bottom; but it made no difference.... Its on the last line of the tooltip hover span block.

Take a look here, you will see what i mean:

Www.comparedrs.com

Cheers
Do you mean how it goes off the right side of the page?  If so, get rid of the margin-left: -999em;
and start over with left:100px; and see what happens.

If that is not what you mean, please explain further.
ASKER CERTIFIED SOLUTION
Avatar of Robert Granlund
Robert Granlund
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial