www.webdeveloper.com
Results 1 to 7 of 7

Thread: disabling background-color for images hover

  1. #1
    Join Date
    Feb 2005
    Posts
    59

    Arrow disabling background-color for images hover

    if I'm using a link hover for texts that adds a background color as in
    PHP Code:
    a:hover {
        
    background-color#000000;

    how do I disable this hover for images so it doesn't get the background color?

  2. #2
    Join Date
    Nov 2003
    Location
    Jerryville, Tejas
    Posts
    11,715
    Try something like

    a:hover img { background-color: none; }
    "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." Brian W. Kernighan

  3. #3
    Join Date
    Jul 2005
    Location
    USA
    Posts
    3,910
    none is not a valid value for background-color. You mean transparent.

    Code:
    background-color: transparent;
    http://www.w3.org/TR/REC-CSS2/colors...ckground-color
    Learn CSS. | SSI | PHP includes | X/HTML Validator | CSS validator | Dynamic Site Solutions

    Design/program for Firefox (and/or Opera), apply fixes for IE, not the other way around.

    Check out my blog.

  4. #4
    Join Date
    Feb 2005
    Posts
    59
    both doesn't work
    any other solutions?

  5. #5
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,157
    CSS:
    Code:
    a.image:hover { background-color: transparent; }
    HTML:
    Code:
    <a class="image" href="whatever.html"><img src="pic.gif"></a>
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  6. #6
    Join Date
    Feb 2005
    Posts
    59
    is there any other way to do that?

  7. #7
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,157
    You are applying the background color to the A element, not the IMG, and I do not know of anyway in CSS to apply style X to element Y only if it does not contain element Z. (You can do the inverse: and apply a style to element Z only if it is contained by element Y, but that's no help in this situation.)
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles