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: 6
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: 5
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: 6
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
Click here for more information
 
Join Date: Sep 2004
Location: Israel
Posts: 29,234 Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)  Folding Points: 586788 Folding Title: Super Ultimate Folder - Level 2Folding Points: 586788 Folding Title: Super Ultimate Folder - Level 2Folding Points: 586788 Folding Title: Super Ultimate Folder - Level 2Folding Points: 586788 Folding Title: Super Ultimate Folder - Level 2Folding Points: 586788 Folding Title: Super Ultimate Folder - Level 2Folding Points: 586788 Folding Title: Super Ultimate Folder - Level 2Folding Points: 586788 Folding Title: Super Ultimate Folder - Level 2
Time spent in forums: 3 Months 2 Weeks 2 Days 22 m 3 sec
Reputation Power: 2470
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,907 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 15 h 28 m 41 sec
Reputation Power: 93
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,268 Lafinboy User rank is Sergeant Major (2000 - 5000 Reputation Level)Lafinboy User rank is Sergeant Major (2000 - 5000 Reputation Level)Lafinboy User rank is Sergeant Major (2000 - 5000 Reputation Level)Lafinboy User rank is Sergeant Major (2000 - 5000 Reputation Level)Lafinboy User rank is Sergeant Major (2000 - 5000 Reputation Level)Lafinboy User rank is Sergeant Major (2000 - 5000 Reputation Level)  Folding Points: 29199 Folding Title: Starter FolderFolding Points: 29199 Folding Title: Starter Folder
Time spent in forums: 2 Weeks 1 Day 11 h 5 m 21 sec
Reputation Power: 36
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
Click here for more information
 
Join Date: Sep 2004
Location: Israel
Posts: 29,234 Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)  Folding Points: 586788 Folding Title: Super Ultimate Folder - Level 2Folding Points: 586788 Folding Title: Super Ultimate Folder - Level 2Folding Points: 586788 Folding Title: Super Ultimate Folder - Level 2Folding Points: 586788 Folding Title: Super Ultimate Folder - Level 2Folding Points: 586788 Folding Title: Super Ultimate Folder - Level 2Folding Points: 586788 Folding Title: Super Ultimate Folder - Level 2Folding Points: 586788 Folding Title: Super Ultimate Folder - Level 2
Time spent in forums: 3 Months 2 Weeks 2 Days 22 m 3 sec
Reputation Power: 2470
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,907 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 15 h 28 m 41 sec
Reputation Power: 93
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,268 Lafinboy User rank is Sergeant Major (2000 - 5000 Reputation Level)Lafinboy User rank is Sergeant Major (2000 - 5000 Reputation Level)Lafinboy User rank is Sergeant Major (2000 - 5000 Reputation Level)Lafinboy User rank is Sergeant Major (2000 - 5000 Reputation Level)Lafinboy User rank is Sergeant Major (2000 - 5000 Reputation Level)Lafinboy User rank is Sergeant Major (2000 - 5000 Reputation Level)  Folding Points: 29199 Folding Title: Starter FolderFolding Points: 29199 Folding Title: Starter Folder
Time spent in forums: 2 Weeks 1 Day 11 h 5 m 21 sec
Reputation Power: 36
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,907 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 15 h 28 m 41 sec
Reputation Power: 93
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
Click here for more information
 
Join Date: Sep 2004
Location: Israel
Posts: 29,234 Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 22nd Grade (Above 100000 Reputation Level)  Folding Points: 586788 Folding Title: Super Ultimate Folder - Level 2Folding Points: 586788 Folding Title: Super Ultimate Folder - Level 2Folding Points: 586788 Folding Title: Super Ultimate Folder - Level 2Folding Points: 586788 Folding Title: Super Ultimate Folder - Level 2Folding Points: 586788 Folding Title: Super Ultimate Folder - Level 2Folding Points: 586788 Folding Title: Super Ultimate Folder - Level 2Folding Points: 586788 Folding Title: Super Ultimate Folder - Level 2
Time spent in forums: 3 Months 2 Weeks 2 Days 22 m 3 sec
Reputation Power: 2470
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





 Free IT White Papers!
 
Create the Optimal Architecture for your Critical Applications
Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.

 
Five Best Practices for Deploying a Successful Service-Oriented Architecture
This white paper describes the benefits you can expect with SOA, and how IBM can help take your business there.

 
Gartner Magic Quadrant for Application Delivery Controllers
Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.

 
Knowledge is Power
What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.

 
Rationalizing the Multi-Tool Environment
The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek