tags:

views:

23

answers:

2

Hei guys, I have the following problem:

  • List item

As I can see those arrows are not aligned with the text, I've tried alot of things but I didn't find a solution, mabe you can help me, here is my code:

    .domains-wrapper .sidebar{
        width: 203px;
    }
                   /* For the background */
        .domains-wrapper .links .the-top{
            background: url(/images/top-sidebar-domains.png) no-repeat;
            width: 202px;
            height: 7px;
        }

                    /* For the background */
        .domains-wrapper .links .repeat{
            background: url(/images/repeat-sidebar-domains.png) repeat-y;
            width: 202px;
        }

                            /*---HERE STARTS THE CODE FOR THE LIST ITEMS---*/

            .domains-wrapper .links .repeat ul{
                padding-top: 14px;
                padding-bottom: 14px;
                padding-left:8px;
                padding-right: 8px;
            }
                .domains-wrapper .links .repeat ul li{
                    font-size: 12px;
                    font-weight: bold;
                    padding-left: 5px;
                    height: 47px;
                    border-bottom: 1px solid #f1f1f1;
                }
                .domains-wrapper .links .repeat ul li.hover{
                    background-color: #71ab32;
                }
                .domains-wrapper .links .repeat ul li.active a{
                    background: url(/images/sidebar-domains-arrows.png) no-repeat 0px 0px;
                }                   
                    .domains-wrapper .links .repeat ul li a{
                        display: inline-block;
                        background: url(/images/sidebar-domains-arrows.png) no-repeat 0px -96px;
                        padding-left: 29px;
                        color: #000;
                        height: 25px;
                        line-height: 47px;
                    }

                    .domains-wrapper .links .repeat ul li.hover a{
                        background: url(/images/sidebar-domains-arrows.png) no-repeat 0px -46px;
                        color: #fff;
                    }
                    /*---HERE ENDS THE CODE FOR THE LIST ITEMS---*/


                    /* For the background */
        .domains-wrapper .links .bottom{
            background: url(/images/bottom-sidebar-domains.png) no-repeat;
            width: 202px;
            height: 7px;                
        }

AND THE HTML

            <div class="links">
            <div class="the-top"></div>
            <div class="repeat">
                <ul>
                    <li class="active"><a href="#">Link 1</a></li>
                    <li><a href="#">Link 1</a></li>
                    <li><a href="#">Link 1</a></li>
                    <li><a href="#">Link 1</a></li>
                </ul>
            </div>
            <div class="bottom"></div>
        </div><!-- end /.links -->

What I'm doing WRONG?

A: 

Your background arrow is part of your a tag. How about:

padding-left: 29px;
background: url(/images/sidebar-domains-arrows.png) no-repeat left center;

For all cases?

R. Hill
Well, I can't do that, as you can see that the hover statement needs a lil bit of padding-left for the arrow.
Uffo
I don't understand your statement. From the snapshot you supplied, the background images used for the arrow are exactly the same size, hovered or not. I would think the same padding applies to both hover and non-hover state. I don't understand also the -96px and -46px you are using for the two states. Are you using a single PNG with two images in it?
R. Hill
@R. Hill, it´s called a css-sprite; multiple images in one big image. It reduces the number of connections when loading the page (= speeds up loading) and avoids the flickering that occurs the first time the hover image gets displayed as it is not loaded yet.
jeroen
I learned something, thanks for the info.
R. Hill
+1  A: 

It seems you're using a css-sprite. Just adjust the numbers (-46 and -96) until it is right and get rid of the inconsistencies like a height that is smaller than the line-height.

Edit: By the way, you might want to switch to block instead of inline-block for the links for IE6.

jeroen
This is what i've done, and also removed the height! Thx
Uffo
My understanding is that inline-block works for native inline elements in IE6, but not for native block elements.
R. Hill
@R. Hill, I thought that was IE7, but to be honest, I don´t know it that well. As it does not seem to make a difference in this case, I would just use `block` to be on the safe side.
jeroen