HighDots Forums  

CSS rollover to change background image

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


Discuss CSS rollover to change background image in the Cascading Style Sheets forum.



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

Default CSS rollover to change background image - 09-02-2004 , 04:24 PM






I have the following code:
<style>
#item1
{
DISPLAY: block;
BACKGROUND: url(ProjMenuImgs/ProjBtn.gif) no-repeat 0px 0px;
WIDTH: 87px;
HEIGHT: 94px;
}
#item1:hover { background-position: 0 -92px; }
</style>...<A id="item1" class="toggle" href="#"></A>The ProjBtn has top and
bottom half for the rollover effect. However, I found that if I change
#item1 to 'a' (or assign a class to the a and change it to '.toggle'), e.g:
#item1:hover { background-position: 0 -92px; }to a:hover {
background-position: 0 -92px; }(or .toggle:hover {...},the rollover won't
work. Since I have a lot of Links (each has the top/bottom images) need have
the rollover function. I don't want to give every anchor an ID. Any problem
in my current code? Thanks. Or any better way to implement image toggling
when mouse over?



Reply With Quote
  #2  
Old   
Nik Coughin
 
Posts: n/a

Default Re: CSS rollover to change background image - 09-02-2004 , 09:44 PM






nick wrote:
Quote:
The ProjBtn has
top and bottom half for the rollover effect. However, I found that if
I change #item1 to 'a' (or assign a class to the a and change it to
'.toggle'), e.g: #item1:hover { background-position: 0 -92px; }to
a:hover { background-position: 0 -92px; }(or .toggle:hover {...},the
rollover won't work. Since I have a lot of Links (each has the
top/bottom images) need have the rollover function. I don't want to
give every anchor an ID. Any problem in my current code? Thanks. Or
any better way to implement image toggling when mouse over?
I don't really understand what you mean. I do it like this:
http://www.nrkn.com/cssRollover/




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.