Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-23-2013, 10:58 PM   PM User | #1
njfail
Regular Coder

 
Join Date: Aug 2010
Posts: 130
Thanks: 2
Thanked 0 Times in 0 Posts
njfail is an unknown quantity at this point
hover or click ? icon for help

I want to create little ? icons that when you hover over them or click them, they show a little notification. Kind of like when you hover over a link with title, it'll show what the title is. Well in this case, I'd like it to show a few sentences giving people some information.

I tried searching for how to do it, but I guess I just don't know what to search for, because I couldn't find anything

Could someone tell me how this is done?

Thanks!
njfail is offline   Reply With Quote
Old 01-23-2013, 11:18 PM   PM User | #2
VIPStephan
The fat guy next door


 
VIPStephan's Avatar
 
Join Date: Jan 2006
Location: Halle (Saale), Germany
Posts: 7,699
Thanks: 5
Thanked 875 Times in 850 Posts
VIPStephan is a jewel in the roughVIPStephan is a jewel in the roughVIPStephan is a jewel in the rough
That’s called “tooltip” and there is a default browser function for that – as you already noted –, the title attribute. It can be used on any element. If you want custom tooltips you can do like this:

Code:
<div class="info">
  [info icon may go here]
  <div>(text here)</div>
</div>
Code:
.info {position: relative;}
.info div {
  display: none;
  background: white;
  padding: 10px;
  width: 150px;
  top: 5px;
  left: 5px;
  position: absolute;
}
.info:hover div {display: block;}
Adjust as necessary.
__________________
Don’t click this link!
VIPStephan is offline   Reply With Quote
Old 01-23-2013, 11:20 PM   PM User | #3
Excavator
Master Coder


 
Excavator's Avatar
 
Join Date: Dec 2006
Location: Alaska
Posts: 9,410
Thanks: 22
Thanked 1,765 Times in 1,749 Posts
Excavator has a spectacular aura aboutExcavator has a spectacular aura aboutExcavator has a spectacular aura about
Hello njfail,
You can put a title on an image that works the same. If that doesn't give you enough control, there are several jQuery solutions for tooltips.
__________________
Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad
Excavator is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:20 PM.


Advertisement
Log in to turn off these ads.