Web Layout
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsWeb DesignWeb Layout

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 ASP Free Forums Sponsor:
  #1  
Old May 17th, 2005, 05:39 PM
oren oren is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 36 oren User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 24 m 29 sec
Reputation Power: 4
CSS hover

Hi,

I was wondering if there is way of changing the color or background-image of one element when hovering over any other element.
Something that I know is possible with javascript, but I want to know if this can be done using pure CSS.

Example:

If i have 5 links in a horizontal row and I would like different images to appear below them in another <div> tag when I hover over them.

is this possible?
do u have an example?

thanks a lot,
Oren

Reply With Quote
  #2  
Old May 17th, 2005, 11:37 PM
medianox's Avatar
medianox medianox is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2005
Location: Chicago, IL
Posts: 157 medianox User rank is Private First Class (20 - 50 Reputation Level)medianox User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 22 h 47 m 49 sec
Reputation Power: 4
Send a message via ICQ to medianox Send a message via AIM to medianox Send a message via MSN to medianox Send a message via Yahoo to medianox
You're gonna hafta use a bit of javascript to call the CSS I think... like this:
CSS:
Code:
 <style type='text/css'>
 .no1 {
 background-color:#ffffff;
 }
 .no2 {
 background-color:#ff9933; /*orange*/
 }
 </style>
 
 


HTML:
Code:
 <div onmouseover="document.getElementById('area').className='no2';" onmouseout="document.getElementById('area').className='no1';">
text
</div>
<br />
<div id='area' class='no1'>
Text 2
</div>
 


I tested it - should work fine. Is this what you had in mind? Or would you like me to expand?

Reply With Quote
  #3  
Old May 20th, 2005, 12:51 AM
oren oren is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 36 oren User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 24 m 29 sec
Reputation Power: 4
Quote:
Originally Posted by medianox
You're gonna hafta use a bit of javascript to call the CSS I think... like this:
CSS:
Code:
<style type='text/css'>
.no1 {
background-color:#ffffff;
}
.no2 {
background-color:#ff9933; /*orange*/
}
</style>
 


HTML:
Code:
<div onmouseover="document.getElementById('area').className='no2';" onmouseout="document.getElementById('area').className='no1';">
text
</div>
<br />
<div id='area' class='no1'>
Text 2
</div>


I tested it - should work fine. Is this what you had in mind? Or would you like me to expand?


Got it, thanx!

Reply With Quote
  #4  
Old May 20th, 2005, 06:45 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 45th Plane (27000 - 27499 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 27,250 Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)  Folding Points: 355057 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355057 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355057 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355057 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355057 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355057 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 6 Days 10 h 43 m 15 sec
Reputation Power: 1778
you can add hover sub-class for any element in html but it won't work for IE browser, for now... hopefully they would support it in IE7 though.

Reply With Quote
  #5  
Old May 21st, 2005, 01:03 AM
baseballdude_'s Avatar
baseballdude_ baseballdude_ is offline
Expert Learner
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2005
Location: Wisconsin
Posts: 1,878 baseballdude_ User rank is Second Lieutenant (5000 - 10000 Reputation Level)baseballdude_ User rank is Second Lieutenant (5000 - 10000 Reputation Level)baseballdude_ User rank is Second Lieutenant (5000 - 10000 Reputation Level)baseballdude_ User rank is Second Lieutenant (5000 - 10000 Reputation Level)baseballdude_ User rank is Second Lieutenant (5000 - 10000 Reputation Level)baseballdude_ User rank is Second Lieutenant (5000 - 10000 Reputation Level)baseballdude_ User rank is Second Lieutenant (5000 - 10000 Reputation Level)  Folding Points: 22104 Folding Title: Starter FolderFolding Points: 22104 Folding Title: Starter Folder
Time spent in forums: 1 Week 5 Days 11 h 55 m 55 sec
Reputation Power: 62
Send a message via AIM to baseballdude_ Send a message via MSN to baseballdude_ Send a message via Yahoo to baseballdude_ Send a message via Google Talk to baseballdude_
No JS needed, though like Shadow said, it doesn't work in IE.

Code:
.item {
 	 background-color: #000;
 }
 .item:hover {
 	 background-color: #FFF;
 }

Reply With Quote
  #6  
Old May 21st, 2005, 07:42 AM
Lafinboy's Avatar
Lafinboy Lafinboy is offline
The Laughing Moderator
ASP Free Loyal (3000 - 3499 posts)
 
Join Date: Apr 2004
Location: Sydney, Australia
Posts: 3,267 Lafinboy User rank is Sergeant (500 - 2000 Reputation Level)Lafinboy User rank is Sergeant (500 - 2000 Reputation Level)Lafinboy User rank is Sergeant (500 - 2000 Reputation Level)Lafinboy User rank is Sergeant (500 - 2000 Reputation Level)Lafinboy User rank is Sergeant (500 - 2000 Reputation Level)  Folding Points: 29199 Folding Title: Starter FolderFolding Points: 29199 Folding Title: Starter Folder
Time spent in forums: 2 Weeks 1 Day 10 h 48 m 12 sec
Reputation Power: 15
Send a message via ICQ to Lafinboy Send a message via AIM to Lafinboy Send a message via MSN to Lafinboy Send a message via Yahoo to Lafinboy Send a message via Skype to Lafinboy
BBD & Shadow - the question was about changing the background of an unrelated element from the one being hovered over

Reply With Quote
  #7  
Old May 21st, 2005, 12:59 PM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 45th Plane (27000 - 27499 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 27,250 Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)  Folding Points: 355057 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355057 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355057 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355057 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355057 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355057 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 6 Days 10 h 43 m 15 sec
Reputation Power: 1778
Quote:
Originally Posted by Lafinboy
BBD & Shadow - the question was about changing the background of an unrelated element from the one being hovered over

lol good catch... so hover is misleading word in this case.

Reply With Quote
  #8  
Old May 21st, 2005, 01:31 PM
baseballdude_'s Avatar
baseballdude_ baseballdude_ is offline
Expert Learner
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2005
Location: Wisconsin
Posts: 1,878 baseballdude_ User rank is Second Lieutenant (5000 - 10000 Reputation Level)baseballdude_ User rank is Second Lieutenant (5000 - 10000 Reputation Level)baseballdude_ User rank is Second Lieutenant (5000 - 10000 Reputation Level)baseballdude_ User rank is Second Lieutenant (5000 - 10000 Reputation Level)baseballdude_ User rank is Second Lieutenant (5000 - 10000 Reputation Level)baseballdude_ User rank is Second Lieutenant (5000 - 10000 Reputation Level)baseballdude_ User rank is Second Lieutenant (5000 - 10000 Reputation Level)  Folding Points: 22104 Folding Title: Starter FolderFolding Points: 22104 Folding Title: Starter Folder
Time spent in forums: 1 Week 5 Days 11 h 55 m 55 sec
Reputation Power: 62
Send a message via AIM to baseballdude_ Send a message via MSN to baseballdude_ Send a message via Yahoo to baseballdude_ Send a message via Google Talk to baseballdude_
Haha, whoops...good eye lafinboy

Reply With Quote
  #9  
Old May 21st, 2005, 08:34 PM
Lafinboy's Avatar
Lafinboy Lafinboy is offline
The Laughing Moderator
ASP Free Loyal (3000 - 3499 posts)
 
Join Date: Apr 2004
Location: Sydney, Australia
Posts: 3,267 Lafinboy User rank is Sergeant (500 - 2000 Reputation Level)Lafinboy User rank is Sergeant (500 - 2000 Reputation Level)Lafinboy User rank is Sergeant (500 - 2000 Reputation Level)Lafinboy User rank is Sergeant (500 - 2000 Reputation Level)Lafinboy User rank is Sergeant (500 - 2000 Reputation Level)  Folding Points: 29199 Folding Title: Starter FolderFolding Points: 29199 Folding Title: Starter Folder
Time spent in forums: 2 Weeks 1 Day 10 h 48 m 12 sec
Reputation Power: 15
Send a message via ICQ to Lafinboy Send a message via AIM to Lafinboy Send a message via MSN to Lafinboy Send a message via Yahoo to Lafinboy Send a message via Skype to Lafinboy
Probably should have been described as a mouseover event rather than a hover. But now we're getting back into semantics

Reply With Quote
  #10  
Old May 21st, 2005, 08:42 PM
baseballdude_'s Avatar
baseballdude_ baseballdude_ is offline
Expert Learner
ASP Free Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2005
Location: Wisconsin
Posts: 1,878 baseballdude_ User rank is Second Lieutenant (5000 - 10000 Reputation Level)baseballdude_ User rank is Second Lieutenant (5000 - 10000 Reputation Level)baseballdude_ User rank is Second Lieutenant (5000 - 10000 Reputation Level)baseballdude_ User rank is Second Lieutenant (5000 - 10000 Reputation Level)baseballdude_ User rank is Second Lieutenant (5000 - 10000 Reputation Level)baseballdude_ User rank is Second Lieutenant (5000 - 10000 Reputation Level)baseballdude_ User rank is Second Lieutenant (5000 - 10000 Reputation Level)  Folding Points: 22104 Folding Title: Starter FolderFolding Points: 22104 Folding Title: Starter Folder
Time spent in forums: 1 Week 5 Days 11 h 55 m 55 sec
Reputation Power: 62
Send a message via AIM to baseballdude_ Send a message via MSN to baseballdude_ Send a message via Yahoo to baseballdude_ Send a message via Google Talk to baseballdude_
I would assume Shadow Wizard could easily achieve this with JavaScript. :P

Reply With Quote
  #11  
Old May 22nd, 2005, 01:07 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 45th Plane (27000 - 27499 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 27,250 Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 12nd Grade (Above 100000 Reputation Level)  Folding Points: 355057 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355057 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355057 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355057 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355057 Folding Title: Super Ultimate Folder - Level 1Folding Points: 355057 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 6 Days 10 h 43 m 15 sec
Reputation Power: 1778
Quote:
Originally Posted by baseballdude_
I would assume Shadow Wizard could easily achieve this with JavaScript. :P

medianox did this in post #2, I couldn't give any better code.

Reply With Quote
Reply

Viewing: ASP Free ForumsWeb DesignWeb Layout > CSS hover


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