Advanced Web Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsWeb DesignAdvanced Web Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old April 10th, 2006, 03:14 PM
pfwebadmin pfwebadmin is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2006
Posts: 3 pfwebadmin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 25 m 30 sec
Reputation Power: 0
Change background of UL for each LI hover?

Hi All,

Anyone know of a way to change acheive this behaviour?

I want to have several links in LI and when one hovers over the LI, the background of the whole UL changes (not just the background of the list item itself).

Thanks in advance for any pointers.

Cheers,

:)Ben

Reply With Quote
  #2  
Old April 10th, 2006, 04:08 PM
Kravvitz Kravvitz is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2005
Location: USA
Posts: 135 Kravvitz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 23 h 45 m 13 sec
Reputation Power: 4
Code:
ul:hover {
  background-color: #fd9;
}


IE(4 through 6)/Win only support :hover on <a> elements.
Three ways to simulate :hover in IE5-6/Win:
Dean Edward's "IE7" patch for IE5-6
whatever:hover
http://www.htmldog.com/articles/suckerfish/

Reply With Quote
  #3  
Old April 10th, 2006, 08:53 PM
pfwebadmin pfwebadmin is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2006
Posts: 3 pfwebadmin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 25 m 30 sec
Reputation Power: 0
RE: Change background of UL for each LI hover?

Thanks for the reply, Kravvitz.

"UL:Hover" would change when one hovered over the UL, though, no?

How would that vary it for each LI hover?

:)Ben

Reply With Quote
  #4  
Old April 10th, 2006, 09:25 PM
Kravvitz Kravvitz is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2005
Location: USA
Posts: 135 Kravvitz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 23 h 45 m 13 sec
Reputation Power: 4
You didn't say that you wanted to use a different color for each <li>.

You would need to use JavaScript.

It would be better to not use inline events, however, for the purposes of providing you with an example, I will use them here.
Code:
<li onmouseover="if(this.parentNode) this.parentNode.style.backgroundColor='#fd9';" 
onmouseout="if(this.parentNode) this.parentNode.style.backgroundColor='';"></li>

Reply With Quote
  #5  
Old April 11th, 2006, 08:46 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
If your CSS stylesheet predefined a background color, your mouseout will set it to null... do'nt forget to put an appropriate value in there if you want your UL to have a background when someone mouse is elsewhere on the page.

It's fairly obvious, but I had to point it out.
__________________
Daryl's Homepage | My Blogroll | My Profile | Firefox supporter!
DevArticles Forum Moderator

"The net is a waste of time, and that's exactly what's right about it." -- William Gibson

Reply With Quote
  #6  
Old April 11th, 2006, 09:08 AM
pfwebadmin pfwebadmin is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2006
Posts: 3 pfwebadmin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 25 m 30 sec
Reputation Power: 0
RE: Change background of UL for each LI hover?

Yeah, was afraid I'd have to use JS. Was hoping there was a way to do it with just CSS, but oh well. Thanks for the responses.

Ben

Reply With Quote
  #7  
Old April 12th, 2006, 09:25 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
CSS3 introduces some interesting pseudo-classes as far as :first-child, :last-child, or my favourite, :nth-child(even)... but alas, no sign of :parent... I can't help but think it would destroy the idea of "Cascading"

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsWeb DesignAdvanced Web Development > Change background of UL for each LI 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!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

Request Your Free Technology Downloads!
 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

Request Your Free Technology Downloads!
 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

Request Your Free Technology Downloads!
 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

Request Your Free Technology Downloads!
 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

Request Your Free Technology Downloads!
 

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





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT