Forum Moderators: open

Message Too Old, No Replies

Anchor link box around letters size

         

Hugene

10:28 pm on Nov 1, 2009 (gmt 0)

10+ Year Member



Hello all,

I used CSS, the background-color: black; attribute for the a.hover tag, in order to have the background of the anchor link change color when the mouse is over it.

But the problem is that I want the "box" around the link words is too large, I want to restrict it to be just as big as the letters.

Is there a way to do it with CSS?

I tried the old way, putting each link in their own table cell, but it still doesn't work, it's still the same size of the anchor box.

Thanks

swa66

11:09 pm on Nov 1, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Make your anchors smaller ?

longen

11:19 pm on Nov 1, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You could test if any of these make a difference:

font-size: 1em;

line-height: 100%;

rocknbil

4:39 pm on Nov 2, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Did you try removing all padding and margins on the anchor style? If you do and it makes it "too tight" against other elements, change the padding of the element containing the anchor. Untested, but something like

#nav li a { margin:0; padding:0; }

#nav { text-align: center; }
#nav li {
display:inline;
margin:0;
padding: 6px;
}

<ul id="nav">
<li><a href="#">nav one</a></li>
<li><a href="#">nav two</a></li>
<li><a href="#">nav three</a></li>
</ul>