【问题标题】:100% height inner table100%高度内桌
【发布时间】:2019-02-07 22:28:25
【问题描述】:

我正在发送多封电子邮件。他们共享布局的一部分需要左侧的白色和黄色设计。 table1 没有固定的高度,因为根据发送的电子邮件会有不同的内容。如何让 table2 完全填写高度?我正在使用第三方软件来生成 html,所以“花哨”的内联 CSS 是不行的。

<table name="table1">
  <tr>
    <td>
      <table height="100%" name="table2">
        <tr>
          <td height="100%" width="10px" bgcolor="white"></td>
          <td height="100%" width="30px" bgcolor="yellow"></td>
        </tr>
      </table>
    </td>
    <td>
      text that can so on and on and on...</br>
      more text</br>
      even more.</br>
    </td>
  </tr>
</table>

【问题讨论】:

  • 你不能使用内联css吗?
  • 不。这是从第三方软件生成的 html,不允许您手动添加 html/css。它只是让您添加“表格”对象等。
  • 在表格中你可以放置内联css还是过滤?
  • 它不是被过滤掉的情况,是软件甚至不允许你输入内联css。

标签: html-table html-email


【解决方案1】:

如果您想拉伸整个高度,为什么不松开表 2 并执行以下操作:

<table name="table1">
  <tr> 
    <td width="10px" bgcolor="white"></td>
    <td width="30px" bgcolor="yellow"></td>     
    <td>
      text that can so on and on and on...<br/>
      more text<br/>
      even more.<br/>
    </td>
  </tr>
</table>

还是我误解了你的问题?

【讨论】:

  • 我很乐意这样做。但这是一项更大工作的一部分,因此由于当前结构,table1 必须保留。我只能直接更改与 table2 相关的内容。
  • 那么无法将表格拉伸 100%。
  • 该死。好的,回到绘图板。谢谢。
  • table1之前可以拉伸td
【解决方案2】:

将第一个 &lt;td&gt; 标记(包含 table2)更改为 &lt;td height="100%"&gt; 怎么样?这样单元格的高度最大,而不仅仅是表格的高度。

【讨论】:

    【解决方案3】:

    你可以用 JavaScript 做到这一点

    <table> 
      <tr> 
        <td id="td1"> 
          <table bgcolor="red" id="table1"> 
            <tr> 
              <td width="10px" bgcolor="white">s </td> 
              <td width="30px" bgcolor="yellow">s </td> 
            </tr> 
          </table> 
        </td> 
        <td> 
          text that can so on and on and on...</br> 
          more text</br> 
          even more.</br> 
        </td> 
      </tr> 
    </table> 
    <script> 
        document.getElementById("table1").style.height = document.getElementById("td1").offsetHeight + "px";
    </script> 
    

    【讨论】:

    • 他说的是发邮件,不允许js。
    猜你喜欢
    • 1970-01-01
    • 2011-12-15
    • 2012-09-27
    • 2015-05-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-09
    相关资源
    最近更新 更多