Note that there are some explanatory texts on larger screens.

plurals
  1. POchrome vs FF/IE/Opera in calculating table cell width ? (table-layout:fixed)
    primarykey
    data
    text
    <p>I've searched now for almost half a day... but I couldn't find out why chrome6/7 seems to be the only browser in comparison to IE8/FF3.6/Opera that does not add the padding to the specified width of an table cell.</p> <p>Of course this becomes crucial if you're working with table-layout:fixed, due to the fact that all of a sudden they have to pay attention to the specified px widths.</p> <p><b>Okay finally my question:</b> does anyone know why Chrome calculates differently, and which browser is right (standard conform), and hopefully, is there an elegant solution?</p> <p>At the moment, my only solution would be a conditional comment with a chrome.css where I add the padding to the width manually ... shiver...</p> <p><i>(btw: anyone who feels tempted to tell that px widths are not proper webdeveloping... feel free to leave this page silently)</i></p> <p><b>ADDITION:</b> (<i>in respect to the replys</i>)<br/> first of all thank you for your immediate replys... i was trying to make it as short as possible, and there for i reduced the facts to the minimum... but, as you mentioned, there are a lots of varibales in webdeveloping and so i try to clarify...</p> <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4 /strict.dtd"&gt; &lt;html&gt; &lt;head&gt; &lt;style type="text/css"&gt; div { width:300px; } table { table-layout:fixed; width:100%; height:50px; } td.col1 { width:20px; background-color:blue; } td.col2 { width:40px; background-color:red; } td.col3 { width:60px; background-color:yellow; } td.col3 { width:auto; background-color:yellow; } td { padding:5px; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;div&gt; &lt;table cellpadding="0" cellspacing="0"&gt; &lt;tr&gt; &lt;td class="col1"&gt;&lt;/td&gt; &lt;td class="col2"&gt;&lt;/td&gt; &lt;td class="col3"&gt;&lt;/td&gt; &lt;td class="col4"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/div&gt; &lt;/body&gt; </code></pre> <p></p> <p>now if you toggle the css line </p> <pre><code>td { padding:5px; } </code></pre> <p>in different browsers, you'll see that chrome includes the padding, within the width, while the others add it</p> <p>hope thats helps to clarify and thanks in advance<br/> berny</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload