Note that there are some explanatory texts on larger screens.

plurals
  1. POTD width not changing CSS HTML
    primarykey
    data
    text
    <p>I have a table, first row 4 items (one tr, 4 td's), second row 1 item (another tr, 1 td)</p> <p>I want the second row item to align center, so I want the td on the bottom row to be width 100% to fill the tr, but it is not working. Here is my current code:</p> <pre><code>&lt;table style="width:100%;"&gt; &lt;tbody&gt;&lt;tr&gt; &lt;td style="padding:20px 5px 5px 5px; text-align:center;"&gt; &lt;div style="height:75px; width:75px; border-color:#8AAEA4; border-style:solid; border-width:2px; display: block; margin-left:auto; margin-right:auto;"&gt; &lt;img height="75px" width="75px" src="/images/icons/default.jpg"&gt;&lt;/div&gt;&lt;form style="display:inline; margin:0; padding:0; " action="/dashboard/shop_window/" method="post" onsubmit="return confirm('Are you sure?');"&gt; &lt;input type="hidden" name="action" value="tcd.profile.delete.shop.window.item"&gt; &lt;input type="hidden" name="item_id" value=""&gt; &lt;input class="add_to_sw" style="cursor: pointer; cursor: hand; background-color:#FFF;" type="submit" value="Delete"&gt; &lt;/form&gt; &lt;/td&gt; &lt;td style="padding:20px 5px 5px 5px; text-align:center;"&gt; &lt;div style="height:75px; width:75px; border-color:#8AAEA4; border-style:solid; border-width:2px; display: block; margin-left:auto; margin-right:auto;"&gt; &lt;img height="75px" width="75px" src="/images/icons/default.jpg"&gt;&lt;/div&gt;&lt;form style="display:inline; margin:0; padding:0; " action="/dashboard/shop_window/" method="post" onsubmit="return confirm('Are you sure?');"&gt; &lt;input type="hidden" name="action" value="tcd.profile.delete.shop.window.item"&gt; &lt;input type="hidden" name="item_id" value=""&gt; &lt;input class="add_to_sw" style="cursor: pointer; cursor: hand; background-color:#FFF;" type="submit" value="Delete"&gt; &lt;/form&gt; &lt;/td&gt; &lt;td style="padding:20px 5px 5px 5px; text-align:center;"&gt; &lt;div style="height:75px; width:75px; border-color:#8AAEA4; border-style:solid; border-width:2px; display: block; margin-left:auto; margin-right:auto;"&gt; &lt;img height="75px" width="75px" src="/images/icons/default.jpg"&gt;&lt;/div&gt;&lt;form style="display:inline; margin:0; padding:0; " action="/dashboard/shop_window/" method="post" onsubmit="return confirm('Are you sure?');"&gt; &lt;input type="hidden" name="action" value="tcd.profile.delete.shop.window.item"&gt; &lt;input type="hidden" name="item_id" value=""&gt; &lt;input class="add_to_sw" style="cursor: pointer; cursor: hand; background-color:#FFF;" type="submit" value="Delete"&gt; &lt;/form&gt; &lt;/td&gt; &lt;td style="padding:20px 5px 5px 5px; text-align:center;"&gt; &lt;div style="height:75px; width:75px; border-color:#8AAEA4; border-style:solid; border-width:2px; display: block; margin-left:auto; margin-right:auto;"&gt; &lt;img height="75px" width="75px" src="/images/icons/default.jpg"&gt;&lt;/div&gt;&lt;form style="display:inline; margin:0; padding:0; " action="/dashboard/shop_window/" method="post" onsubmit="return confirm('Are you sure?');"&gt; &lt;input type="hidden" name="action" value="tcd.profile.delete.shop.window.item"&gt; &lt;input type="hidden" name="item_id" value=""&gt; &lt;input class="add_to_sw" style="cursor: pointer; cursor: hand; background-color:#FFF;" type="submit" value="Delete"&gt; &lt;/form&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="background-color: #FF0000; width:inherit; padding:10px 5px 5px 5px; text-align:center;"&gt; &lt;div style="height:75px; width:75px; border-color:#8AAEA4; border-style:solid; border-width:2px; display: block; margin-left:auto; margin-right:auto;"&gt; &lt;img height="75px" width="75px" src="/images/icons/default.jpg"&gt;&lt;/div&gt;&lt;form style="display:inline; margin:0; padding:0; " action="/dashboard/shop_window/" method="post" onsubmit="return confirm('Are you sure?');"&gt; &lt;input type="hidden" name="action" value="tcd.profile.delete.shop.window.item"&gt; &lt;input type="hidden" name="item_id" value=""&gt; &lt;input class="add_to_sw" style="cursor: pointer; cursor: hand; background-color:#FFF;" type="submit" value="Delete"&gt; &lt;/form&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; </code></pre> <p>Can anyone see what I'm doing wrong? </p> <p>Here is the jsfiddle: <a href="http://jsfiddle.net/UqPXw/" rel="nofollow noreferrer">JSFIDDLE</a></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