HTML:表格后面的段落,显示在表格右侧

时间:2013-10-10 19:31:23

标签: html alignment

我们正在设计一个应用程序,它将向管理人员发送电子邮件,提醒他们必须进行某些批准。电子邮件是HTML格式,包含一个表格。我们不明白我们做错了什么导致最后一段显示在表格的右边而不是在其下面。

下面是一个样本。这个工具“整洁”,我依靠这样的东西,这次没有提示。

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content=
"HTML Tidy for Linux/x86 (vers 6 November 2007), see www.w3.org"
name="generator">
<meta content='text/html; charset=us-ascii' http-equiv=
"Content-Type">
<style type="text/css">
   body {font-family: Calibri;   }
   caption {font-family: Calibri;color: 'black'; font-size: '125%;  }
   table.main tr { };
   table.main td.bottomcaption {text-align: 'center'; vertical-align: 'middle'; font-family: 'Calibri'; color: 'black'; font-color: 'black'; font-size: '125%';   }
   table.main th {vertical-align: 'bottom'; color: blue; background-color: lightyellow;   }
</style>
<title>Payable Time awaiting approval</title>
</head>
<body>
<p>Hello, <strong>Daffy Duck</strong>:</p>
<p>According to our records, the following Payable Time is awaiting
approval. Items shown below must be approved in order for
compensation to take place.<br></p>
<p>For questions, please contact <a href=
"MAILTO:SUPPORT@OUR_ORG.COM">Support</a></p>
<table align="left" border="1" class='main' summary="Pending details">
<caption ><strong>Awaiting approval by your reporting
structure</strong></caption>
<tr>
<th align="left">&nbsp;<br>
Name</th>
<th align="center">&nbsp;<br>
ID</th>
<th align="center">Work<br>
Date</th>
<th align="center">&nbsp;<br>
Type</th>
<th align="center">&nbsp;<br>
Hours</th>
</tr>
<tr>
<td colspan="5">Reporting to Mickey M Mouse (MMM)</td>
</tr>
<tr>
<td align="left">Daisy</td>
<td align="left">D_DUCK</td>
<td align="center">04/29/2013</td>
<td align="left">REG</td>
<td align="right">8.00</td>
</tr>
<tr>
<td align="left">Daisy</td>
<td align="left">D_DUCK</td>
<td align="center">05/01/2013</td>
<td align="left">REG</td>
<td align="right">8.00</td>
</tr>
<tr>
<td align="left">Daisy</td>
<td align="left">D_DUCK</td>
<td align="center">05/02/2013</td>
<td align="left">OT</td>
<td align="right">7.50</td>
</tr>
</table>
<p>&nbsp;<br></p>
<p>&nbsp;</p>
<p>This message comes from The Support Team</p>
</body>
</html>

我们非常希望文本“此消息来自......”显示在表格下方,而是显示在表格的右侧,与表格的顶部对齐。这适用于IE7,IE8和Firefox 12。

我很感激有任何建议来帮助解决这个问题。

此致 丹尼斯

3 个答案:

答案 0 :(得分:3)

只需将align="left"移至您的桌子即可。

请参阅链接:http://jsfiddle.net/rhyDe/

在IE10,FF24,Chrome 30上测试

答案 1 :(得分:2)

您可以使用类似的标记:http://jsfiddle.net/7fAy9/2/

<table border="1">
  <thead>
    <tr>
      <th>Month</th>
      <th>Savings</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>January</td>
      <td>$100</td>
    </tr>

  </tbody>
  <tfoot>
    <tr>
      <td colspan="2">This is the text you want under the table</td>
    </tr>
  </tfoot>
</table>

,或者 你可以这样做:http://jsfiddle.net/NNrnc/

<table border="1">
  <caption align="bottom">My savings</caption>
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
</table>

但请注意,HTML5中不推荐使用caption对齐, 在HTML5中执行此操作的正确方法是:

<table border="1">
  <caption style="caption-side:bottom">My savings</caption>
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
</table>

答案 2 :(得分:-1)

轻松修复。将其添加到最后一句:

<p style="float:left;">This message comes from the support team.</p>