Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/38.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/12.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
DIV内的HTML表未正确对齐文本_Html_Css - Fatal编程技术网

DIV内的HTML表未正确对齐文本

DIV内的HTML表未正确对齐文本,html,css,Html,Css,我正在尝试将表格单元格中的文本对齐为右对齐,但由于某些原因,我无法使其正常工作 下面是我的代码 <div style="text-align: right;"> <table> <tr> <td>15</td> </tr> <tr> <td>20</td> &

我正在尝试将表格单元格中的文本对齐为右对齐,但由于某些原因,我无法使其正常工作

下面是我的代码

<div style="text-align: right;">
    <table>
         <tr>
             <td>15</td>
         </tr>
         <tr>
             <td>20</td>
         </tr>
    </table>
</div>

15
20
这为什么不能使文本向右对齐


注:我没有选择使用单独的CSS,它必须是“内联”的,如上所述。

这是您的表格,其中有一行较长的文本。您将看到文本完全对齐,但表格不是全宽的


15
20
更长的