473,324 Members | 1,678 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

image class with hover

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.
Jul 21 '05 #1
8 12766
JLahm <jl***@columbus.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...
Jul 21 '05 #2
Els
Neal wrote:
JLahm <jl***@columbus.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)
Jul 21 '05 #3
Els <el*********@tiscali.nl> wrote:
Or a smart girl? ;-)
Or!
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.
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.

Jul 21 '05 #4
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.

Jul 21 '05 #5
logic_earth wrote:
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
Jul 21 '05 #6
Els
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
http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Jul 21 '05 #7
Els wrote:
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
Jul 21 '05 #8
Els
JLahm wrote:
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 -
Jul 21 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

33
by: Thomas Mlynarczyk | last post by:
Hi, I'm looking for a way to put a 1px solid border around the image in this link: <a href="some.html"><img src="some.gif"></a> Well, that, by itself, is simple. However, I would like to have a...
3
by: Gnolen | last post by:
Hi, I am wondering if someone could guide me in the right direction about this. How can I make div 'one' hover? Does not need to be clickable/link...It would be easy if the images was not...
2
by: Elisa | last post by:
I have two images, each with defined CSS hover states. I would like a mouseover on one image to trigger the hover state of the other image. Is this possible using javascript? If so, how? Any...
8
by: Gabriella | last post by:
Hi, I have the CSS class below, and the image (pro.gif) is not showing on my page. It is showing ONLY where's some text in the div, but all I need is the image itself. ..pro {background-image:...
7
by: fredo | last post by:
I've studied Eric Meyer's pure css popups, version two: http://meyerweb.com/eric/css/edge/popups/demo2.html which pops up an image when I roll over a text link. Now I want to pop up a large...
2
by: andrewtayloruk | last post by:
Hi, i'm pretty new to CSS and html so please go easy on me. I'm trying to make a menu, the idea is that when you hover over the images in the menu they glow. To do this i have set up the...
11
by: timmyb | last post by:
I have an image that is supposed to be in a centered div in the center of a page. It looks fine in IE7. But in Firefox, the image is pushed way over to the right. ...
5
by: studentofknowledge | last post by:
hi guys im new to javascript and need some guidence please.. im trying to display a 400x400 pixel coloured area in the middle of a webpage that stays in the middle with a browser window resize....
16
by: stevedude | last post by:
CSS newbie again. I have a problem trying to get coffee mug images within anchor tags to center with my link text for a vertical list menu. If I use the horizontal/vertical properties of...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.