我需要完美对齐“文本一”和“文本二”。第二个文本在表格内。我需要它以这种方式使我的程序与我稍后添加的功能一起工作。我对 vertical-align 很不满意,因为根据我使用的浏览器,它会给我不同的结果。我是在做错什么,还是每个浏览器都会给出不同的结果。
使用 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
上(并删除 vertical-align :text-bottom;
来自 table
标签)。
关于javascript - 与表格中的文字完美对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36488817/