0

I want to have a horizontal row of 3 links that use the same CSS style, but each link needs a small icon to the left, e.g | home | about | contact ...where | represents the icon.

I can get close using

.nav a {
    padding-left:8px;
    line-height:17px;
    background-image:url(/admin/img/icon.gif);
    background-repeat:no-repeat;
    font-size:11px;
    height:17px;
    vertical-align:middle;
    display:block;
}

but this only works for one link and I have to display as "block", I need the same effect where the text is vertically aligned to the icon but keeping the link as an inline element so the varying widths are not an issue.

3
  • can you give your markup code here?So that we can help you as soon as possible. Commented Apr 2, 2012 at 15:58
  • I am not 100% of this, but line-height is not used since you used display block. (this is for information sake) Commented Apr 2, 2012 at 16:09
  • why do you "need" to use the display as block? Commented Apr 2, 2012 at 16:11

1 Answer 1

2

Try using display:inline-block; instead of block.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.