sinθ
sinθ

Reputation: 11503

Getting UL border to wrap only around text

I have a UL that I'm using for a menue of styled. Unfortunately, when I try to add a boarder it goes across the whole screen because they are li elements (and are display: block). I also don't want to define a fixed width for the elements, and instead want the width to be the width necessary for the text.

JsFiddle: http://jsfiddle.net/5xu6t/

Upvotes: 0

Views: 455

Answers (2)

qooplmao
qooplmao

Reputation: 17759

Would require adding extra tag into your html but it seems to do what you want.

<li><span>Test</span></li>

And bodge the css a bit too.

http://jsfiddle.net/BVYM7/

Upvotes: 2

deach
deach

Reputation: 360

Try:

<li><span>Test</span></li>

span{
    border: solid 1px red;
}  

Upvotes: 2

Related Questions