You are here: Re: CSS equivalent of single-cell table ? « HTML « IT news, forums, messages
Re: CSS equivalent of single-cell table ?

Posted by Ben C on 11/01/07 23:13

On 2007-11-01, MangroveRoot <zcukpkn02@sneakemail.com> wrote:
> I've looked for tutorials on how to do this for some years,
> with no success.
>
> Most of the time, I'm a good boy and only use <TABLE> (etc)
> to format tabular data.
>
> However, there remains one thing that <TABLE> does excellently
> that I have yet to find a way to do using solely CSS:
>
> Put a block of text *in a box*,
> which box sizes itself to the size of the *content*,
> not to some arbitrary fixed width or some percentage of the window.
[...]
> Surely CSS can do this; how?

You need a "shrink-to-fit" box.

Apart from tables and table cells, floats, inline-blocks and
absolutely/fixed positioned boxes are shrink-to-fit.

Out of that lot floats are probably the simplest.

Put your content in a float, with auto width, and the float will shrink
to fit the content (according to CSS 2.1, in any half-decent
browser, and even in IE).

Of course you can't centre a float so I hope that's not your next
question.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация