与表格中的文本完美对齐

making a perfect alignment with text out and in a table

本文关键字:完美 对齐 文本 表格      更新时间:2024-02-24

我需要将"文本编号一"answers"文本编号二"完全对齐。第二个文本在表格中。我需要它以这种方式使我的程序与稍后添加的函数一起工作。我在垂直对齐方面遇到了麻烦,因为它会根据我使用的浏览器给我不同的结果。是我做错了什么,还是每个浏览器都会给出不同的结果。

使用Microsoft Edge和IE10,对齐非常完美。使用Chrome、Mozilla和Opera时,它并没有完全一致。

代码是

<!DOCTYPE html>
<html>
<head></head>
<body style="font-size:18pt"><br><br>
    <span>  text number one
        <table style="margin:0; padding:0; border:0; border-spacing:0; vertical-align:text-bottom; display:inline-table">
            <tr>
                <td style="padding:0">
                    text number two
                </td>
            </tr>
        </table>
    </span>
</body>
</html>

尝试vertical-align:baseline;,但在td上,而不是在table上(并从table标记中删除vertical-align:text-bottom;)。

这是一个代码笔:http://codepen.io/anon/pen/yOpzdK