HighDots Forums  

image class with hover

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


Discuss image class with hover in the Cascading Style Sheets forum.



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

Default image class with hover - 01-07-2005 , 07:45 PM






I have defined a class for my images called .image that specifies the
default border color, width and style. I'd like to be able to have the
pseudo elements link, visited and active have one color and style, while
the hover class has a different color and style. I have the entries:

a:link .image {
border-color: #151515;
border-style: solid;
border-width: 2px;
}

a:visited .image {
border-color: #151515;
border-style: solid;
border-width: 2px;
}

a:hover .image {
border-color: #FC7400;
border-style: dotted;
border-width: 2px;
}

a:active .image {
border-color: #151515;
border-style: solid;
border-width: 2px;
}

My HTML then has:

<a href="index.php?cat=4"><img
src="albums/nature/flora/thumb_red%20tulip.jpg" class="image"
width="144" height="200" alt=""></a>

This works in Firefox, but not in IE. In IE, once a page is visited
hover does not work. I've looked around for a solution but haven't found
one. Any help would be greatly appreciated! Thanks.

Reply With Quote
  #2  
Old   
Neal
 
Posts: n/a

Default Re: image class with hover - 01-07-2005 , 08:06 PM






JLahm <jlahm (AT) columbus (DOT) rr.com> wrote:

Quote:
I have defined a class for my images called .image that specifies
the default border color, width and style. I'd like to be able to
have the pseudo elements link, visited and active have one color and
style, while the hover class has a different color and style.

(snip)

My HTML then has:

a href="index.php?cat=4"><img
src="albums/nature/flora/thumb_red%20tulip.jpg" class="image"
width="144" height="200" alt=""></a

This works in Firefox, but not in IE. In IE, once a page is visited
hover does not work. I've looked around for a solution but haven't
found one. Any help would be greatly appreciated! Thanks.
IE has, shall we say, issues with :hover.

You will in all likelihood need to do the hover effect on a, and not
on img. Unless a smartguy comes along knowing a little more than me...


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

Default Re: image class with hover - 01-07-2005 , 08:19 PM



Neal wrote:

Quote:
JLahm <jlahm (AT) columbus (DOT) rr.com> wrote:

I have defined a class for my images called .image that
specifies the default border color, width and style. I'd
like to be able to have the pseudo elements link, visited
and active have one color and style, while the hover class
has a different color and style.

(snip)

My HTML then has:

a href="index.php?cat=4"><img
src="albums/nature/flora/thumb_red%20tulip.jpg"
class="image" width="144" height="200" alt=""></a

This works in Firefox, but not in IE. In IE, once a page
is visited hover does not work. I've looked around for a
solution but haven't found one. Any help would be greatly
appreciated! Thanks.

IE has, shall we say, issues with :hover.

You will in all likelihood need to do the hover effect on
a, and not on img. Unless a smartguy comes along knowing a
little more than me...
Or a smart girl? ;-)

Pics on my site have no issues with it, but iirc, I had to
state the general a:link, a:visited etc colours first, and
then later in the stylesheet make the a:link img, a:visited
img etc styles.

Feel free to check my stylesheets.
All colours, including link colours and border colours on
linked images are in http://locusmeus.com/colors.css

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Now playing: The Cure - In Between Days (Acoustic)


Reply With Quote
  #4  
Old   
Neal
 
Posts: n/a

Default Re: image class with hover - 01-07-2005 , 08:21 PM



Els <els.aNOSPAM (AT) tiscali (DOT) nl> wrote:

Quote:
Or a smart girl? ;-)
Or!

Quote:
Pics on my site have no issues with it, but iirc, I had to
state the general a:link, a:visited etc colours first, and
then later in the stylesheet make the a:link img, a:visited
img etc styles.
That's something else too - as we can't see the whole stylesheet of
the OP, no way to determine whether a later rule is conflicting.

Quote:
Feel free to check my stylesheets.
All colours, including link colours and border colours on
linked images are in http://locusmeus.com/colors.css
And JLahm, if this still eludes you after you visit El's beautiful
site, post a URL to a stripped-down test page demonstrating the issue.



Reply With Quote
  #5  
Old   
logic_earth
 
Posts: n/a

Default Re: image class with hover - 01-09-2005 , 12:48 PM



There is way to make ":hover" to work on any element but at a cost,
your css won't validate and it requires aa extra script but it will
only effect IE6.

http://www.xs4all.nl/~peterned/csshover.html
Note: This is an IE6 only script.


Reply With Quote
  #6  
Old   
JLahm
 
Posts: n/a

Default Re: image class with hover - 01-09-2005 , 06:53 PM



logic_earth wrote:
Quote:
There is way to make ":hover" to work on any element but at a cost,
your css won't validate and it requires aa extra script but it will
only effect IE6.

http://www.xs4all.nl/~peterned/csshover.html
Note: This is an IE6 only script.

Thanks everyone for the suggestions! You've all said what I had
basically gleaned from searching the net - darn. :-) I think I will give
the scripting approach a try.

Els: On an earlier reply you pointed me to your website. Using Firefox
it works fine, but with IE6.0 it doesn't always highlight an image when
you hover over it. I will look at your css more closely as it seems that
(usually) it is just the last image clicked that does not get
highlighted when you hover over it (which is better than mine does!).

Thanks again for everyone's help - I do appreciate all of the friendly
and helpful advice!

Jim
www.backporchphotography.com


Reply With Quote
  #7  
Old   
Els
 
Posts: n/a

Default Re: image class with hover - 01-09-2005 , 07:50 PM



JLahm wrote:

Quote:
Els: On an earlier reply you pointed me to your website.
Using Firefox it works fine, but with IE6.0 it doesn't
always highlight an image when you hover over it. I will
look at your css more closely as it seems that (usually) it
is just the last image clicked that does not get
highlighted when you hover over it (which is better than
mine does!).
Can you give me an example of where you saw this happening?
I just checked in IE6.0 (XP), and all pics change their border-
color on hover, no matter if I clicked them before or not.
The only way to stop them from being affected, is to click one,
then drag the mouse away from it, before releasing the mouse-
button. But then it has the :active colour, which I set to be
the same as the :hover colour.

--
Els
http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -


Reply With Quote
  #8  
Old   
JLahm
 
Posts: n/a

Default Re: image class with hover - 01-10-2005 , 07:54 PM



Els wrote:
Quote:
JLahm wrote:


Els: On an earlier reply you pointed me to your website.
Using Firefox it works fine, but with IE6.0 it doesn't
always highlight an image when you hover over it. I will
look at your css more closely as it seems that (usually) it
is just the last image clicked that does not get
highlighted when you hover over it (which is better than
mine does!).


Can you give me an example of where you saw this happening?
I just checked in IE6.0 (XP), and all pics change their border-
color on hover, no matter if I clicked them before or not.
The only way to stop them from being affected, is to click one,
then drag the mouse away from it, before releasing the mouse-
button. But then it has the :active colour, which I set to be
the same as the :hover colour.

Els: I noticed it on your home page when using IE6.0. Initially, all
have an orange? border. The cute baby picture will change to a blue
border when you hover over it, but the others do not change. If I click
on any image and then return to the home page, that image will now have
a blue (active) border. However, the only one that will turn from orange
to blue is still the baby image.

When I go to the Rotterdam images, all work just fine.

When I use Firefox, the front page also works fine (all images will
change to a blue border when you hover over one).

Hope this helps!

Jim


Reply With Quote
  #9  
Old   
Els
 
Posts: n/a

Default Re: image class with hover - 01-11-2005 , 02:33 AM



JLahm wrote:

Quote:
Els wrote:
JLahm wrote:
[img border-color changing on hover in IE6]
Using Firefox it works fine, but with IE6.0 it doesn't
always highlight an image when you hover over it.

Can you give me an example of where you saw this
happening?

Els: I noticed it on your home page when using IE6.0.
Initially, all have an orange? border. The cute baby
picture will change to a blue border when you hover over
it, but the others do not change. If I click on any image
and then return to the home page, that image will now have
a blue (active) border. However, the only one that will
turn from orange to blue is still the baby image.

When I go to the Rotterdam images, all work just fine.

When I use Firefox, the front page also works fine (all
images will change to a blue border when you hover over
one).

Hope this helps!
Yup, thanks :-)
I found the problem occurs on floated images, so it probably
has to do with those images being block level elements. (The
baby pic and the ones on the thumbnail pages are inline), not
sure if there is a real work-around, but I'll look into it,
and post here if I find a solution.

--
Els
http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -


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.