Click to See Complete Forum and Search --> : Box size dictated by text?


SuzanneB
05-24-2005, 04:06 AM
Hi everyone,
what I need is a "box" who's width is dictated by the text it contains. I don't know of a way of doing that other than using a table with one cell that contains the text. I need to be able to set the padding in CSS, so:


<table class="blah">
<tr>
<td>HELLO</td>
</tr>
</table>

.blah{padding:blah blah blah blah;}

Surely there must be a better way than using a table??

Fang
05-24-2005, 06:31 AM
What is the limiting factor, height or width?

SuzanneB
05-24-2005, 01:14 PM
Hi Fang!
Width.
I want the width the padding larger than the text.

Fang
05-24-2005, 01:51 PM
<p style="float:left; white-space:nowrap; padding:3px; border:1px solid blue;">Surely there must be a better way than using a table??</p>

SuzanneB
05-24-2005, 03:54 PM
Oh, use a p! Yes. I wasn't thinking of that - you are right.