HighDots Forums  

background color mouseover

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss background color mouseover in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Bastardx
 
Posts: n/a

Default background color mouseover - 01-15-2006 , 09:12 AM






Hi
Can I change newsContainer background color with mousover in following
example of my code?

<div class="newsContainer"><div class="newsTitle><a href="#">My news
title</a></div>
<div class="newsText">My news text My news text My news text My news text
</div></div>




Reply With Quote
  #2  
Old   
Jim Moe
 
Posts: n/a

Default Re: background color mouseover - 01-15-2006 , 03:24 PM






Bastardx wrote:
Quote:
Can I change newsContainer background color with mousover in following
example of my code?

div class="newsContainer"><div class="newsTitle><a href="#">My news
title</a></div
div class="newsText">My news text My news text My news text My news text
/div></div

Which one do you want to change?
The basic method is element_or_id_or_class:hover { background-color: #xxx; }
Be aware, though, the IE applies :hover *only* to the <a> element.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)


Reply With Quote
  #3  
Old   
Bastardx
 
Posts: n/a

Default Re: background color mouseover - 01-16-2006 , 08:03 AM




Quote:
div class="newsContainer"><div class="newsTitle><a href="#">My news
title</a></div
div class="newsText">My news text My news text My news text My news text
/div></div

Which one do you want to change?
The basic method is element_or_id_or_class:hover { background-color:
#xxx; }
Be aware, though, the IE applies :hover *only* to the <a> element.
I want to change newsContainer background.
Yes I have noticed that IE has problem with that.
Is there any other solutions with pure css?





Reply With Quote
  #4  
Old   
Jim Moe
 
Posts: n/a

Default Re: background color mouseover - 01-16-2006 , 01:54 PM



Bastardx wrote:
Quote:
div class="newsContainer"><div class="newsTitle><a href="#">My news
title</a></div
The basic method is element_or_id_or_class:hover { background-color:
#xxx; }
Be aware, though, the IE applies :hover *only* to the <a> element.

I want to change newsContainer background.
Yes I have noticed that IE has problem with that.
Is there any other solutions with pure css?

No. :hover+background is the only way in CSS.
You can make the IE problem less obvious by setting .newcontainer a {
display: block}. This causes the background to fill the div. It does have
side-effects, though, since <a> is now a block rather than inline.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)


Reply With Quote
  #5  
Old   
Alan J. Flavell
 
Posts: n/a

Default Re: background color mouseover - 01-16-2006 , 03:00 PM



On Sun, 15 Jan 2006, Jim Moe wrote:

Quote:
Be aware, though, the IE applies :hover *only* to the <a> element.
More accurately, IE applies :hover only to <a> elements which
have an href= attribute.

But don't be fooled by this: if one codes a:hover, a www-compatible
browser will action the :hover properties irrespective of whether the
<a> element has an href= or not. If you only want links to be hovered
- and not <a name="..."> - then code a:link:hover (which also works on
IE), and then, if you've also styled a:visited, give thought to what
you want to happen when you hover over visited links - you might want
a style for a:visited:hover too, and take care to get them in the
right order.

h t h


Reply With Quote
Reply




Thread Tools
Display Modes

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



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.