You are here: Re: Why is the table less wide than the div when they both have the same width? « HTML « IT news, forums, messages
Re: Why is the table less wide than the div when they both have the same width?

Posted by Jonathan N. Little on 06/24/06 14:07

Rik wrote:
> dorayme wrote:
>> Put this up on a server or else try to validate it... it has
>> invalid property values ("hand" ????), you have dashes in things
>> between b and ackground-color etc etc. Sharpen yourself up young
>> man.
>
> I think those dashes are created in posting, not in the actual content.
> Anyway, to the op: when asking question, try to reproduce your 'error' in
> the least amount of code.
>
> In this case:
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
> <head>
> <title>asdlk</title>
> </head>
> <body>
> <table style="border:1px solid black;width:99%;">
> <tr>
> <td>More Search Options</td>
> </tr>
> </table>
> <div style="border:1px solid black;width:99%;">
> blaat
> </div>
> </body>
> </html>
>
> The problem here is that the border taken into account for the table when
> deciding the width, and added to the div element after the width has been
> decided. So the div will always be 2*border-width bigger. One should work
> with a percentual border in this case, and adjust one elements width to that
> percentage. That's badly supported though, and will result in disappearing
> borders on low resolutions.
>
> My workaround:
> - display both as block

That make no sense, both DIV and TABLE are block by default, unless
styled otherwise somewhere else (The arguamt for posting a YRL and not
pasted code)

> - don't give the elements that width, arrange it in <body> (or another
> containing element), or give left- and rightmargin.

I'd say the most likely culprit is the margin setting is different for
TABLE and DIV by default for browser in question. Explicitly setting the
margin and padding can usually fix it.
<snip>

--
Take care,

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

 

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

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