Note that there are some explanatory texts on larger screens.

plurals
  1. POHTML: relative positioned overlapping elements in TD makes TD too wide
    primarykey
    data
    text
    <p>I have code that generates a <code>TABLE</code> that contains relative positioned elements causing elements to overlap in a <code>TD</code>. The <code>TD</code> then appears too wide.</p> <p>Here's a short example of the table:</p> <pre><code>&lt;html&gt;&lt;body&gt; &lt;table&gt; &lt;tr style="background-color: rgb(221, 255, 221)"&gt; &lt;td style="padding-left:20px;"&gt; text1 &lt;select size="1" style="width: 262px"&gt; &lt;option&gt;&lt;/option&gt; &lt;option&gt;12345&lt;/option&gt; &lt;/select&gt; &lt;input type="text" size="5" style="position: relative; left: -262px; width: 239px"&gt; &lt;span style="position: relative; left: -239px"&gt;text2&lt;/span&gt; &lt;input type="text" size="5" style="position: relative; left: -239px"&gt; &lt;span style="position: relative; left: -239px"&gt;text3&lt;/span&gt; &lt;input type="text" size="5" style="position: relative; left: -239px"&gt; &lt;span style="position: relative; left: -239px"&gt; &lt;/span&gt; &lt;/td&gt; &lt;td&gt; info &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/body&gt;&lt;/html&gt; </code></pre> <p>The <code>input</code>-element appears above the <code>select</code>-element.</p> <p>Obviously I don't have any widths set in <code>TD</code>, <code>TR</code> or <code>TABLE</code>. So it's the browser that makes the first column too wide. The width of the empty space seems to be the width of the <code>input</code>-element.</p> <p>How can I circumvent this? Basically I want the first column only to be as wide as necessary.</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.
    1. This table or related slice is empty.
    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