You are here: Re: Width of tables next to float « HTML « IT news, forums, messages
Re: Width of tables next to float

Posted by Ben C on 08/29/07 14:49

On 2007-08-29, Chris Hughes <Chris.Hughes.Personal@hotmail.com> wrote:
> Personally, I'd forget about the conditionals.
>
> Setting display: block on a table should make it consume the entire
> width on all browsers (I use it all the time on my own site).

But that's rather different from a table that's width: 100%.

If you make the table display: block, then, yes, its auto width fills
the available width. But the <tr> inside it is then put inside an
anonymous table with auto shrink-to-fit width.

You can see the effect if you try:

<table style="display: block; background-color: pink">
<tr>
<td style="background-color: green">foo</td>
</tr>
</table>

A big pink block, but a small green td, since the anonymous table around
the td shrinks to fit it.

If on the other hand you try

<table style="width: 100%; background-color: pink">
<tr>
<td style="background-color: green">foo</td>
</tr>
</table>

You get a big green td, since the table it's in is now 100% of the width
available (in Firefox, I haven't been following whether width: 100% on a
table has some problem in other browsers).

 

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

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