简体   繁体   English

HTML表格未全宽TD

[英]HTML Table not full width td

For some reason I can not get the td with 100% inside the table and align the text as center . 由于某种原因,我无法在表中获取100%td 并将文本对齐为center

How can I make the <td class="order-details"> full width, so it full the 600px of the table obove? 我怎样才能使<td class="order-details">全宽,使表的600px完全消失呢?

JSFIDDLE: https://jsfiddle.net/61s1cdyo/1/ JSFIDDLE: https ://jsfiddle.net/61s1cdyo/1/

CODE: 码:

<table class="table-bestelling-content" cellpadding="0" cellspacing="0" border="0" width="100%" style="background-color:#ffffff">
  <tr class="details">
      <td align="center">
      <table  class="table-bestelling-content" cellpadding="0" cellspacing="0" border="0" width="100%" style="background-color:#ffffff; max-width: 600px; display: block;">
        <tr align="center" class="header">
              <td class="order-details">
                    <h1 style="text-align: left; display: table-cell; padding: 10px 0px;">ORDER DETAILS</h1>
                </td>
        </tr>
      </table>
    </td>
  </tr>
</table>

Assuming you want to keep the max-width: 600px, you need to remove the display: block from the inner table to make it act like a table. 假设您要保留最大宽度:600px,则需要从内部表中删除display:块,以使其表现得像表一样。

<table class="table-bestelling-content" cellpadding="0" cellspacing="0" border="0" width="100%" style="background-color:#ffffff">
  <tr class="details">
      <td align="center">
      <table  class="table-bestelling-content" cellpadding="0" cellspacing="0" border="0" width="100%" style="background-color:#ffffff; max-width: 600px;">
        <tr align="center" class="header">
              <td class="order-details">
                    <h1 style="text-align: left; display: table-cell; padding: 10px 0px;">ORDER DETAILS</h1>
                </td>
        </tr>
      </table>
    </td>
  </tr>
</table>

Here's a Fiddle 这是小提琴

There is a max-width: 600px inline setting for the nested table. 嵌套表格有一个max-width: 600px内联设置。 If you erase that, it's 100% wide: 如果将其擦除,则为100%宽:

https://jsfiddle.net/b594a5d5/1/ https://jsfiddle.net/b594a5d5/1/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM