Results 1 to 5 of 5

Thread: Problem with link hovering in case of inline-block element IE7

  1. #1
    Join Date
    Jan 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Problem with link hovering in case of inline-block element IE7

    Hello

    I have link <a> as inline-block element (black backround and white color). After what I hover on link I expect change of backround color to white and color to black.

    But it doesnt work. The backround color is not changed and text in my link is also black

    Where can be problem ?

    Thanks

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Works fine here:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css">
    a {
    display: inline-block;
    background-color: #000;
    color: #fff
    }
    a:hover {
    background-color: #fff;
    color: #000
    }
    </style>
    </head>
    <body>
    <a href="#">Test</a>
    </body>
    </html>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jan 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hello

    I've found where is problem, but it appears only in IE. FF,Opera,Chrome is OK.
    The problem causes reset part of CSS for links. If I removed it then everything works fine also in IE.

    Here is my example my small example.
    Note that file test.txt is html document.

    Can somebody explain me where is problem?

    Thanks

  4. #4
    Join Date
    Jan 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hello

    problem causes line font-size: 100%

    why?

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    That's not what I just found. Here, if I include one or both of either:

    Code:
    border: 0;
    or:

    Code:
    background: transparent;
    That's what seems to set it off.

    The border: 0; is technically incorrect, or just something I was always taught to avoid for some reason, it should be (AFAIK) border: none; - If you use that, it may remain and not mess things up for your demo. The background declaration is OK, but less specific than it should be. However, changing it to background-color makes no difference.

    I seriously doubt there is a good explanation for this, as neither of these should affect the color property of a :hover pseudo class. My advice would be to just take the a out of the selector as your comment in the stylesheet indicates and define a separate one for the a tag. The default in all browsers for a is transparent background anyway, so you are losing nothing:

    Code:
    a {
    	margin: 0;
    	padding: 0;
    	outline: 0;
    	border: none;
    	font-size: 100%;
    	vertical-align: baseline;
    }
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

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