Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
HTML表格不是全宽td_Html_Css - Fatal编程技术网

HTML表格不是全宽td

HTML表格不是全宽td,html,css,Html,Css,由于某些原因,我无法获得表内100%的td,并且将文本对齐为中心 如何将设置为全宽,使其充满表obove的600px JSFIDDLE: 代码: 订单详情 嵌套表格有一个最大宽度:600px内联设置。如果将其删除,则其宽度为100%: 假设要保持最大宽度:600px,则需要从内部表格中删除display:块,使其像表格一样工作 <table class="table-bestelling-content" cellpadding="0" cellspacing="0" border="0

由于某些原因,我无法获得表内100%的td,并且将文本对齐为中心

如何将
设置为全宽,使其充满表obove的600px

JSFIDDLE:

代码:


订单详情

嵌套表格有一个
最大宽度:600px
内联设置。如果将其删除,则其宽度为100%:


假设要保持最大宽度: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>

订单详情

这里有一个

您的表格设置为
显示:块
,因此它不再充当表格。删除最大宽度:600px;它会很好地工作,JS小提琴上的代码不在你的问题中。在问题中加一个。只要
max width:600px
在里面,那就没用了-请看下面我的答案。(在snippet窗口中,它只起作用,因为它的宽度小于600px,但在全屏上它不会起作用)他的问题是,他希望TD是600px宽容器的100%全宽,所以我假设不仅是最大宽度:600px是有意的,而且也是期望的行为。
<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>