Reply LinkBack Thread Tools Search this Thread
Old 16-11-2005, 07:15   #1 (permalink)
Accurate
Accurate
 
Accurate's Avatar
 
Join Date: Feb 2003
Location: UK
Posts: 1,311
Text links that underline on mouse-over

I have a few paragraphs on a page that I want to underline when the mouse goes over them... I know this can be done in CSS, but I only want this effect to happen to a few paragraphs.. is there any code I can insert around the selected text to make this happen? (the text isn't image, its actual text)

Many thanks!
__________________
decent web hosting - www.balue.com
.
  Reply With Quote
Old 16-11-2005, 07:18   #2 (permalink)
nakedintruder
www.nakedintruder.com
 
nakedintruder's Avatar
 
Join Date: Jan 2005
Location: Leeds, Yorkshire
Posts: 383
Send a message via MSN to nakedintruder
.wherethisisgoing a:active, .wherethisisgoing a:visited, .wherethisisgoing a:link{text-decoration:none}
.wherethisisgoing a:hover{text-decoration:underline}
  Reply With Quote
Old 16-11-2005, 07:18   #3 (permalink)
gray
i still want paying
 
gray's Avatar
 
Join Date: Oct 2003
Location: newcastle, uk
Posts: 4,768
<p class="foo"><a href="">Foo Link</a></p>

.foo a:hover{
text-decoration: underline;
}

is one way
  Reply With Quote
Old 16-11-2005, 07:21   #4 (permalink)
nakedintruder
www.nakedintruder.com
 
nakedintruder's Avatar
 
Join Date: Jan 2005
Location: Leeds, Yorkshire
Posts: 383
Send a message via MSN to nakedintruder
gray, links are underlined by default so you need to "turn them off" a:link as well, see above
  Reply With Quote
Old 16-11-2005, 07:22   #5 (permalink)
Brown
volkswagen yellow & gold
 
Brown's Avatar
 
Join Date: Apr 2003
Location: london, england.
Posts: 6,147
is the text a link? if not, then why do you want people to think its a link?
  Reply With Quote
Old 16-11-2005, 07:23   #6 (permalink)
pgo
Senior Member
 
Join Date: Jan 2005
Posts: 12,340
If you mean the whole paragraph being underlined, you'll have to use gray's solution, which I would avoid, personally - as your visitors will think it's a giant link (which, according to the HTML, it actually is - it just doesn't go anywhere).

IE doesn't support the :hover pseudoclass on any element besides anchors, so you're out of luck going the simple route that you should be able to go:

<p class="underlineme">blah</p>

p.underlineme:hover {
text-decoration: underline;
}

That would work in Firefox, Safari, Opera, etc - but not IE.

Also something to consider - why would you want to make an entire paragraph underlined? That would make it much harder to read (not to mention confuse your readers like Brown suggests).
  Reply With Quote
Old 16-11-2005, 07:26   #7 (permalink)
Accurate
Accurate
 
Accurate's Avatar
 
Join Date: Feb 2003
Location: UK
Posts: 1,311
Yes the texts are links... but I want the underline to appear when the mouse goes over.

Thanks for the posts so far, will give it a try!
__________________
decent web hosting - www.balue.com
.
  Reply With Quote
Old 16-11-2005, 07:28   #8 (permalink)
Accurate
Accurate
 
Accurate's Avatar
 
Join Date: Feb 2003
Location: UK
Posts: 1,311
Quote:
Originally Posted by pgo

Also something to consider - why would you want to make an entire paragraph underlined? That would make it much harder to read (not to mention confuse your readers like Brown suggests).

The paragraph is only about 9 words long...its more of a sentence. Its the clients request, it should look ok though.
__________________
decent web hosting - www.balue.com
.
  Reply With Quote
Old 16-11-2005, 07:28   #9 (permalink)
gray
i still want paying
 
gray's Avatar
 
Join Date: Oct 2003
Location: newcastle, uk
Posts: 4,768
Quote:
Originally Posted by nakedintruder
gray, links are underlined by default so you need to "turn them off" a:link as well, see above

i just presumed he already had them turned off earlier in the css
  Reply With Quote
Old 16-11-2005, 07:31   #10 (permalink)
Accurate
Accurate
 
Accurate's Avatar
 
Join Date: Feb 2003
Location: UK
Posts: 1,311
I havn't applied any CSS yet to the page. This will be the next step...please don't remind me
__________________
decent web hosting - www.balue.com
.
  Reply With Quote
Old 16-11-2005, 07:32   #11 (permalink)
pgo
Senior Member
 
Join Date: Jan 2005
Posts: 12,340
Oh. I thought you meant a whole paragraph. Nevermind.

In that case, do what nakedintruder originally posted.
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8