Reply to Re: Why is the table less wide than the div when they both have the same width?

Your name:

Reply:


Posted by Jonathan N. Little on 06/24/06 17:18

Rik wrote:
<snip>
> Answer to op's problem:
> In rendering a table browsers seem to take the width including the
> borderwidth, and on div's without borderwidth.
>
> Solution to op's proble"m:
> Use percentual margins, and make a table-cell 100%.

Good work! I'll log that on in the old memory banks. Just for further
info, the margin does not have to be a percent, just has to be set and
set the same for both TABLE and DIV. And the table just has to have one
cell per row set to 100%. For best practice should be in your CSS and
not your markup:

TD.inthemiddle { width: 100%; }

....
<tr><td>left</td><td class="inthemiddle">By Margins</td><td>right</td>

Of course if IE were a browser you could have eliminated the extra class
all together with an adjacent sibling selectors

/* sets the 2nd TD in table to 100% width not 'inthemiddle' needed */
TABLE.bymargin TD + TD { width: 100% }


--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com

[Back to original 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

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