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 15:42

Frank Olieu wrote:
> "Rik" <luiheidsgoeroe@hotmail.com> wrote in
> news:47fc6$449d4911$8259c69c$8422@news2.tudelft.nl:
>
>> In Opera, my tables won't automatically fils 100% of available width
>> without display:block;

Well it will but may be exactly doing what you think, whereas setting
with width may be the more desirable method:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Width VS Block</title>

<style type="text/css">
..bywidth { width: 100%; background-color: #FFD; }
..byblock { display: block; background-color: #FDF; }
TD { background-color: #DFF; }
</style>

</head>
<body>

<table class="bywidth">
<tr><td>left</td><td>By Width</td><td>right</td>
</table>

<table class="byblock">
<tr><td>left</td><td>By Block</td><td>right</td>
</table>

</body>
</html>


>
>> (...) tested it, with margin set to zero for html, body, div & table
>> there is still a difference in width.
>
> I think this makes sense, actually. Default style should be, according to W3C
> recommendation:
> for div: display:block
> for tables: display:table
> Browser vendors could then give them different values...
>
Right DIV and TABLE are both block elements semantically per HTML spec
like P and UL ..., my oversight was the CSS the different type of
'block' display types... display: table & table-cell differ for other
other block elements display: block where the dimensions adjust to fit
content. DIV's sets to display: table-cell can often produce the effect
many newbies are looking for when the try to convert the table layouts
to CSS (but of course it doesn't work in MS IE).

--
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

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