Page 1 of 1

(yet another) CSS question

Posted: Sun Jan 29, 2006 7:08 pm
by srg_13
Hi,

I have a div with one line of text in it, and I was wondering if you can set the width of that div to be the length of that text.

Is this possible? I have tried

Code: Select all

width: auto;
but that didn't work.

Thanks,

-Stephen

Re:(yet another) CSS question

Posted: Thu Feb 02, 2006 3:26 am
by srg_13
Is there no way I could do this???

-Stephen

Re:(yet another) CSS question

Posted: Thu Feb 02, 2006 6:17 am
by whyme_t
Does this work...

Code: Select all

<style type="text/css">
.shrink   { 
   background: #dfd; 
   float: left;
} 

</style>

Code: Select all

<div class="shrink">One line of text</div>
or perhaps...

Code: Select all

<div><span class="shrink">One line of spanned text</span></div>

Re:(yet another) CSS question

Posted: Thu Feb 02, 2006 6:25 am
by Solar
http://en.selfhtml.org is slooooowly coming into existence - they actually translated the chapter on CSS, which you might want to check out.

(The original SelfHTML manual is in German, and respected as the #1 reference by anyone who has seen it. I have no idea why the anglos take so long to translate it - the French and Spanish translations are much better.)