image class with hover

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • JLahm

    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%20tul ip.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.
  • Neal

    #2
    Re: image class with hover

    JLahm <jlahm@columbus .rr.com> wrote:
    [color=blue]
    > 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%20tul ip.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.[/color]

    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...

    Comment

    • Els

      #3
      Re: image class with hover

      Neal wrote:
      [color=blue]
      > JLahm <jlahm@columbus .rr.com> wrote:
      >[color=green]
      >> 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%20tul ip.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.[/color]
      >
      > 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...[/color]

      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)

      Comment

      • Neal

        #4
        Re: image class with hover

        Els <els.aNOSPAM@ti scali.nl> wrote:
        [color=blue]
        > Or a smart girl? ;-)[/color]

        Or!
        [color=blue]
        > 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.[/color]

        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.
        [color=blue]
        > Feel free to check my stylesheets.
        > All colours, including link colours and border colours on
        > linked images are in http://locusmeus.com/colors.css[/color]

        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.

        Comment

        • logic_earth

          #5
          Re: image class with hover

          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.


          Note: This is an IE6 only script.

          Comment

          • JLahm

            #6
            Re: image class with hover

            logic_earth wrote:[color=blue]
            > 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.
            >[/color]

            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

            Comment

            • Els

              #7
              Re: image class with hover

              JLahm wrote:
              [color=blue]
              > 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!).[/color]

              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
              Blog and other pages, mostly outdated.

              Sonhos vem. Sonhos vão. O resto é imperfeito.
              - Renato Russo -

              Comment

              • JLahm

                #8
                Re: image class with hover

                Els wrote:[color=blue]
                > JLahm wrote:
                >
                >[color=green]
                >>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!).[/color]
                >
                >
                > 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.
                >[/color]

                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

                Comment

                • Els

                  #9
                  Re: image class with hover

                  JLahm wrote:
                  [color=blue]
                  > Els wrote:[color=green]
                  >> JLahm wrote:[/color][/color]
                  [img border-color changing on hover in IE6][color=blue][color=green][color=darkred]
                  >>>Using Firefox it works fine, but with IE6.0 it doesn't
                  >>>always highlight an image when you hover over it.[/color]
                  >>
                  >> Can you give me an example of where you saw this
                  >> happening?[/color]
                  >
                  > 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![/color]

                  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
                  Blog and other pages, mostly outdated.

                  Sonhos vem. Sonhos vão. O resto é imperfeito.
                  - Renato Russo -

                  Comment

                  Working...