PDA

View Full Version : [css] setting background color of link


krisleech
07-04-2008, 10:58 AM
I can set the background color of a link easily enough but the background color extends across the entire page. I dont want to set the width in the css as I want a general class I can apply to any link.

.button {
padding:10px;
background-color: yellow;
}

How can I change this css so the background color just wraps the text in a link and does not extend across the entire page? (without having to set width).

Many thanks, K.

Arthur
07-04-2008, 12:14 PM
How can I change this css so the background color just wraps the text in a link and does not extend across the entire page? (without having to set width). .button {
padding:10px;
background-color: yellow;
display: inline;
}

Other display options (http://www.quirksmode.org/css/display.html).

-Arthur