HighDots Forums  

Set background-position in class and background-image in id.

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


Discuss Set background-position in class and background-image in id. in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
tor.brekke.skjotskift@gmail.com
 
Posts: n/a

Default Set background-position in class and background-image in id. - 11-30-2007 , 08:30 AM






I want to set a background-image with an id and use class to create
the rollover effect by altering background-position.

It wont work in either IE or FF. Any suggestions?

HTML
<a href="#" id="knappKalender" class ="knapp" (...)


CSS
a.knapp {
height:105px;
width:105px;
background-position: top left;
}

a.knapp:hover, a.knapp:focus {
background-position:center left;
}

a.knapp:active {
background-position:bottom left;
}

a#knappKalender {
background:url(../images/knapp_kalender.jpg) no-repeat;
}

Reply With Quote
  #2  
Old   
Rik Wasmus
 
Posts: n/a

Default Re: Set background-position in class and background-image in id. - 11-30-2007 , 12:14 PM






On Fri, 30 Nov 2007 15:30:00 +0100, <tor.brekke.skjotskift (AT) gmail (DOT) com>
wrote:

Quote:
I want to set a background-image with an id and use class to create
the rollover effect by altering background-position.

It wont work in either IE or FF. Any suggestions?

HTML
a href="#" id="knappKalender" class ="knapp" (...)


CSS
a.knapp {
height:105px;
width:105px;
background-position: top left;
}

a.knapp:hover, a.knapp:focus {
background-position:center left;
}

a.knapp:active {
background-position:bottom left;
}

a#knappKalender {
background:url(../images/knapp_kalender.jpg) no-repeat;
}
I you use 'background-image:url(..);' instead of 'background:' it will
work in Opera & FF, MSIE (7) will not cooperate it seems.
--
Rik Wasmus


Reply With Quote
  #3  
Old   
tor.brekke.skjotskift@gmail.com
 
Posts: n/a

Default Re: Set background-position in class and background-image in id. - 11-30-2007 , 03:24 PM



On 30 Nov, 19:14, "Rik Wasmus" <luiheidsgoe... (AT) hotmail (DOT) com> wrote:
Quote:
On Fri, 30 Nov 2007 15:30:00 +0100, <tor.brekke.skjotsk... (AT) gmail (DOT) com
wrote:





I want to set a background-image with an id and use class to create
the rollover effect by altering background-position.

It wont work in either IE or FF. Any suggestions?

HTML
a href="#" id="knappKalender" class ="knapp" (...)

CSS
a.knapp {
height:105px;
width:105px;
background-position: top left;
}

a.knapp:hover, a.knapp:focus {
background-position:center left;
}

a.knapp:active {
background-position:bottom left;
}

a#knappKalender {
background:url(../images/knapp_kalender.jpg) no-repeat;
}

I you use 'background-image:url(..);' instead of 'background:' it will
work in Opera & FF, MSIE (7) will not cooperate it seems.
--
Rik Wasmus- Skjul sitert tekst -

- Vis sitert tekst -
Thanks!

Actually it worked with IE7 as well. I'm yet to test with IE6 and I do
not have high expectations :-)

Regards
Tor


Reply With Quote
  #4  
Old   
Rik Wasmus
 
Posts: n/a

Default Re: Set background-position in class and background-image in id. - 11-30-2007 , 07:51 PM



On Fri, 30 Nov 2007 22:24:00 +0100, <tor.brekke.skjotskift (AT) gmail (DOT) com>
wrote:
Quote:
On 30 Nov, 19:14, "Rik Wasmus" <luiheidsgoe... (AT) hotmail (DOT) com> wrote:
On Fri, 30 Nov 2007 15:30:00 +0100, <tor.brekke.skjotsk... (AT) gmail (DOT) com
wrote:
I want to set a background-image with an id and use class to create
the rollover effect by altering background-position.

It wont work in either IE or FF. Any suggestions?

HTML
a href="#" id="knappKalender" class ="knapp" (...)

CSS
a.knapp {
height:105px;
width:105px;
background-position: top left;
}

a.knapp:hover, a.knapp:focus {
background-position:center left;
}

a.knapp:active {
background-position:bottom left;
}

a#knappKalender {
background:url(../images/knapp_kalender.jpg) no-repeat;
}

I you use 'background-image:url(..);' instead of 'background:' it will
work in Opera & FF, MSIE (7) will not cooperate it seems.

Thanks!

Actually it worked with IE7 as well. I'm yet to test with IE6 and I do
not have high expectations :-)
D'oh! Offcourse, in MSIE 7 it does work, provided the <a> has an href
attribute..
--
Rik Wasmus


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.