css - IE 不在表格单元格中居中文本

标签 css internet-explorer text-alignment

我因 IE/CSS 问题而崩溃!我已经尝试了所有(我认为)可以想象的方法来使表格单元格的文本居中。我从旧的、陈旧的方法开始:

<tr>
    <th width="100" align="center" class="centerme">Some text here.</th>
</tr>

然后,我尝试了 CSS:

.centerme {text-align:center;margin:0 auto;}

然后我尝试将样式内联(保留所有其他已经提到的方法):

<tr>
    <th width="100" align="center" class="centerme" style="text-align:center;">Some text here.</th>
</tr>

我可能遗漏了什么?我尝试将 <tr> 居中对齐元素,这应该没有什么区别,但是 IE 是相处的噩梦!请注意,这只是 IE 中的一个问题。在所有其他浏览器中都很好(这是 IE 8)

最佳答案

删除 width="100" 解决了这个问题。

关于css - IE 不在表格单元格中居中文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17304985/

相关文章:

html - 我的一个子 Div 拒绝使用文本对齐居中 :Center

emacs - 通用右对齐功能

html - Bootstrap 4.0 - 带有图像 + 导航栏 + 全高主体的响应式标题

html - 滑动以锚定在纯 html 中

vba - 如何在 Excel VBA Internet Explorer 中使用通配符

jquery - HTML5 视频 + Ajax + IE = 性能差?

Android:如何在 TextView 中对齐文本?

html - WP即footer不在底部

javascript - 显示折叠标题的重置/显示按钮

jquery - IE 兼容 View 模式下的 superfish 菜单错误