Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS trouble with clickable area and small line-height

  • This topic is empty.
Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #26060
    beechertrouble
    Participant

    I’m having trouble with overlapping clickable areas when the line height is set smaller than 1em.

    i.e.:

    Code:

    the buginess being that when you mouse over the lower portion of "TOO" , the "BIG?" is in it’s hover state and is clickable. …

    help?

    #63792

    Can you link to a live example? My first guess is conflicting styles. Do you have padding set on the li or a elements?

    The full section(s) of your CSS dealing with lists and anchors would be helpful.

    #63794
    beechertrouble
    Participant

    I don’t think there are any conflicts … the overlap seems be be based in the <a> …

    here’s a link to the live example:

    http://www.beechersmithstackhouse.info/buggs.html

    thanks

    #63798

    I"m going to have to admit that I’m stumped. I’ll look at it again tomorrow after some sleep, though.

    #63822
    beechertrouble
    Participant

    thanks for trying – i’m still scratching my head too.

    #63930
    ChetGarrison
    Member

    Try putting line-height on the actual list item. Right now there aren’t any styles at all. Try something like this:

    .navbar ul li {
    line-height: .825em;
    }

    Hopefully that’ll help… good luck!

    #63937
    beechertrouble
    Participant

    nope – no luck.
    I set the line-height for both the:
    .navbar ul li
    and
    .navbar ul li a

    to no avail …. i’ll update the live example.

    any other thoughts?

    #63940
    blue642
    Member

    In order to make the "a" tag smaller and avoid the overlap you have to set display to block, and the height to your desired height. But I have a screenshots of some weird handling of this when I get back to my computer. Strange it is.

    #63942
    ChetGarrison
    Member

    Ok.. I’ve been playing around with it for a bit and then I remembered that explorer has a bug with list items and links. For some reason if you add a border it’ll fix the line-height problem, but then you have the problem with the border. I updated your css, so just swap out the old styles with the ones below. I made the border purple so you can see what I’m talking about. Hopefully that’ll work for you, otherwise I don’t think there is a solution. You might have to live with a border, just make it the same color as the background and no one will ever know :)

    Code:
    .navbar a:link {
    color:#484340;
    }

    .navbar a:visited {
    color:#484340;
    }

    .navbar a:hover {
    color:#fa297d;
    padding-left:5px;
    }

    .navbar ul {
    width: 150px;
    }

    .navbar ul li {
    border: 1px solid #9933ff;
    line-height: .8em;
    }

    .navbar ul li a{
    text-decoration: none;
    display: block;
    }

    #63943
    blue642
    Member

    That doesn’t work either… here is the screen shot I was talking about.

    Notice the dotted outline, that is the clickable area (even though firebug shows that the "a" link is contained within the purple borders.) For some reason the clickable are still overlaps when the anchor link does not extend beyond the borders.

    [img]http://img.photobucket.com/albums/v69/blue642/Untitled-1.jpg[/img]

    #63961
    beechertrouble
    Participant

    arg! the mystery continues!
    surely there is a solution other than using images …

    #64510
    beechertrouble
    Participant

    is there no hope of resolution? surely someone out there has faced this problem before?

    … anyone ? …

    #66207
    oldno19
    Member

    I was going crazy trying to figure this out. It took me 15 minutes to find the right keywords to use in google to even find a thread. After reading this thread, I thought "there HAS to be a way" and while there is probably still a cleaner method, I think I might have a solution for you.

    Let’s say your links are set up like this (most importantly, they have a class called "aFix")

    Code:
  • Link Text

In your CSS try doing something like this:

Code:
a.aFix {
display:block;
overflow:hidden;
font-size:36px;
height:30px;
margin-top:-10px;
}

You’ll end up with your links getting pushed up by 10 pixels, but I think you could compensate by giving a class name to your <li> tags and defining a CSS class that compensates with padding-top or something like that.

Depending on the font you’re using, you’ll want to play with the the last three values for font-size, height and margin-top. Give it a whirl and you’ll see what it’s doing.

I didn’t test this with list items, but it is working with my code where the links are wraped in divs instead of list items.

Viewing 13 posts - 1 through 13 (of 13 total)