如何顶部,在跨越多行的<td>单元格中左alignment文本

我有以下的HTML代码:

<table border="1"> <tr> <th>Month</th> <th>Savings</th> </tr> <tr> <td>January</td> <td>$100</td> </tr> <tr> <td>February</td> <td rowspan="2">Save a lot</td> </tr> <tr> <td>March</td> </tr> </table> 

使用CSS样式或其他方法,我可以使文本“节省很多”顶部,左alignment?

 td[rowspan] { vertical-align: top; text-align: left; } 

请参阅: CSS属性select器 。

  <td rowspan="2" style="text-align:left;vertical-align:top;padding:0">Save a lot</td> 

这应该做到这一点。

尝试这个

 <!DOCTYPE html> <html> <head> <style> table, th, td { border: 1px solid black; } </style> </head> <body> <table style="width:50%;"> <tr> <th>Month</th> <th>Savings</th> </tr> <tr style="height:100px"> <td valign="top">January</td> <td valign="bottom">$100</td> </tr> </table> <p><b>Note:</b> The valign attribute is not supported in HTML5. Use CSS instead.</p> </body> </html>