Web Design Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignWeb Design Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 10th, 2004, 12:38 PM
ljCharlie ljCharlie is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 199 ljCharlie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 2 h 56 m 18 sec
Reputation Power: 5
Question Link hover effect

Is there a way to apply the link hover effect on some texts but don't actually link to anywhere? It seems to me that the following CSS will only work if the texts actually have a hyper link to it.

A.myLink:link {color:#FFFFFF;}
A.myLink:visited {color:#003399;}
A.myLink:hover {color:#33FF00;}
A.myLink:active {color:#003399;}

I want to have the effect of the hover effect but without the link.

Any help is appreciated.

ljCharlie

Reply With Quote
  #2  
Old September 10th, 2004, 02:25 PM
edwinbrains's Avatar
edwinbrains edwinbrains is offline
Retired Moderator
Dev Shed God 4th Plane (6500 - 6999 posts)
 
Join Date: Jan 2004
Location: London, UK
Posts: 6,670 edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)  Folding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced Folder
Time spent in forums: 1 Week 6 Days 23 h 36 m 40 sec
Reputation Power: 92
How about this:

Code:
<style type="text/css">
<!--
.myLink:link {color:#FFFFFF;}
.myLink:hover {color:#FF0000;}
-->
</style>

<span class="myLink">Hello world!</span>


That appears to work for me.
__________________
- Edwin -

The General Rules Thread | The General FAQ Thread

Reply With Quote
  #3  
Old September 10th, 2004, 03:21 PM
ljCharlie ljCharlie is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 199 ljCharlie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 2 h 56 m 18 sec
Reputation Power: 5
Thank you very much!

ljCharlie

Reply With Quote
  #4  
Old September 10th, 2004, 03:24 PM
edwinbrains's Avatar
edwinbrains edwinbrains is offline
Retired Moderator
Dev Shed God 4th Plane (6500 - 6999 posts)
 
Join Date: Jan 2004
Location: London, UK
Posts: 6,670 edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)  Folding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced Folder
Time spent in forums: 1 Week 6 Days 23 h 36 m 40 sec
Reputation Power: 92
No problem

Reply With Quote
  #5  
Old September 10th, 2004, 03:33 PM
ljCharlie ljCharlie is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 199 ljCharlie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 2 h 56 m 18 sec
Reputation Power: 5
Question

Well, it doesn't seem to work. Click Here to see the page.

If you view the source, you'll see the code.

ljCharlie

Reply With Quote
  #6  
Old September 10th, 2004, 03:43 PM
edwinbrains's Avatar
edwinbrains edwinbrains is offline
Retired Moderator
Dev Shed God 4th Plane (6500 - 6999 posts)
 
Join Date: Jan 2004
Location: London, UK
Posts: 6,670 edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)  Folding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced Folder
Time spent in forums: 1 Week 6 Days 23 h 36 m 40 sec
Reputation Power: 92
Hmm... the code I tried follows:

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.myLink:link {color:#FFFFFF;}
.myLink:hover {color:#FF0000;}
-->
</style>
</head>

<body>
<span class="myLink">Hello all!</span>
</body>
</html>


The only difference I can see is the <!-- and --> around the style section and the inclusion of a URL in the doctype.

Reply With Quote
  #7  
Old September 10th, 2004, 06:06 PM
jacktasia jacktasia is offline
Contributing User
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2004
Location: Lawrence, Kansas [KU]
Posts: 1,559 jacktasia User rank is Corporal (100 - 500 Reputation Level)jacktasia User rank is Corporal (100 - 500 Reputation Level)jacktasia User rank is Corporal (100 - 500 Reputation Level)jacktasia User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 13 h 57 m 56 sec
Reputation Power: 9
Send a message via AIM to jacktasia
you could always go javascript

Code:

<span onmouseover="this.style.color='green';" onmouseout="this.style.color='black';">Hello all!</span>
__________________
Jack
---------
use code tags

become vegetarian
python? yes, sir!
unarm.org
get firefox


If I helped you then please click the "" in the upper right-hand corner of my post.

Reply With Quote
  #8  
Old September 10th, 2004, 08:54 PM
JFetting JFetting is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: Chicago, IL
Posts: 154 JFetting User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 47 m 35 sec
Reputation Power: 5
With CSS you can simple apply a style to the :hover event of a tag, but don't expect this to work in IE as it only understands the :hover event on links.

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
span.myLink:hover {color:#33FF00;}
</style>
</head>

<body>
<span class="myLink">Test only</span>
</body>
</html>


I just modified the above code. For some reason, I had to use span.myLink to get this to work. I don't think you can use :link for plain text. Again, this won't work in IE. For that, you will need to use javascript.

Hope that helps.

Reply With Quote
  #9  
Old September 11th, 2004, 01:17 AM
jacktasia jacktasia is offline
Contributing User
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2004
Location: Lawrence, Kansas [KU]
Posts: 1,559 jacktasia User rank is Corporal (100 - 500 Reputation Level)jacktasia User rank is Corporal (100 - 500 Reputation Level)jacktasia User rank is Corporal (100 - 500 Reputation Level)jacktasia User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 13 h 57 m 56 sec
Reputation Power: 9
Send a message via AIM to jacktasia
i'd go javascript.

Reply With Quote
  #10  
Old September 13th, 2004, 08:08 AM
ljCharlie ljCharlie is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 199 ljCharlie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 2 h 56 m 18 sec
Reputation Power: 5
Question

Many thanks for all your help. Let's say I go with javascript, how do I simulate the under line part? The example you showed above does not have under line when mouse over.

ljCharlie

Reply With Quote
  #11  
Old September 13th, 2004, 03:58 PM
jacktasia jacktasia is offline
Contributing User
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2004
Location: Lawrence, Kansas [KU]
Posts: 1,559 jacktasia User rank is Corporal (100 - 500 Reputation Level)jacktasia User rank is Corporal (100 - 500 Reputation Level)jacktasia User rank is Corporal (100 - 500 Reputation Level)jacktasia User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 13 h 57 m 56 sec
Reputation Power: 9
Send a message via AIM to jacktasia
Quote:
Originally Posted by ljCharlie
Many thanks for all your help. Let's say I go with javascript, how do I simulate the under line part? The example you showed above does not have under line when mouse over.

ljCharlie



like this:

Code:

<span onmouseover="this.style.color='green';this.style.textDecoration='underline';" onmouseout="this.style.color='black';this.style.textDecoration='none';">Hey there</a>

Reply With Quote
  #12  
Old September 14th, 2004, 07:42 AM
ljCharlie ljCharlie is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 199 ljCharlie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 2 h 56 m 18 sec
Reputation Power: 5
Thumbs up

Thanks!

ljCharlie

Reply With Quote
  #13  
Old September 24th, 2004, 12:43 AM
BonRouge's Avatar
BonRouge BonRouge is offline
Winemaster
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2004
Location: Sendai, Japan
Posts: 1,354 BonRouge User rank is Second Lieutenant (5000 - 10000 Reputation Level)BonRouge User rank is Second Lieutenant (5000 - 10000 Reputation Level)BonRouge User rank is Second Lieutenant (5000 - 10000 Reputation Level)BonRouge User rank is Second Lieutenant (5000 - 10000 Reputation Level)BonRouge User rank is Second Lieutenant (5000 - 10000 Reputation Level)BonRouge User rank is Second Lieutenant (5000 - 10000 Reputation Level)BonRouge User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 3 Weeks 3 Days 2 h 52 m 6 sec
Reputation Power: 85
One alternative is to link to nowhere.

<a href="#">hello</a>

If you click the link ('hello') nothing happens.... Actually - that's not 100% true. You'll hear the little clicking sound you get when you press on a link (or is that just my computer...?) and then it will look like you've visited that link (the link will change colour (unless you've set visited links to have the same colour as regular links)).

Well - it's one idea and it works for me (I do actually set some visited links to be the same colour as unvisited links).

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignWeb Design Help > Link hover effect


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |