Box size dictated by text?

liunx

Guest
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??What is the limiting factor, height or width?Hi Fang!
Width.
I want the width the padding larger than the text.<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>Oh, use a p! Yes. I wasn't thinking of that - you are right.
 
Back
Top