html - <th align '"center"> 不在 Bootstrap 表上工作。可能是什么原因?

标签 html twitter-bootstrap

我有一个 bootstrap 悬停表,我正在尝试使用 <th align="center"> 将列标题对齐到中间.这似乎对表格没有任何影响,但是 <td align="center">正常工作。

这是我的代码:

<table class="table table-hover">
    <thead>
    <tr>
        <th>Title</th>
        <th>Score</th>
        <th align="center">Product</th>    #This line is not working
        <th>Who Reviewed</th>
        <th>When</th>
    </tr>
    </thead>
    <tbody>
    {% for review in object_list %}
        <tr>
            <td><a href="{% url 'backend_reviews_edit' review.pk %}">{{review.title}}</a></td>
            <td align="center">{{ review.score }}</td>
            <td align="center">{{ review.product.title }}</td>
            <td>{{ review.reviewer_name}}</td>
            <td>{{ review.date_created|date:"m-d-Y" }}</td>
        </tr>
    {% endfor %}
    </tbody>
</table>
    </div>

最佳答案

如果您使用的是 Bootstrap ,请使用它的 CSS 规则。

<th class="text-center">Product</th>

关于html - <th align '"center"> 不在 Bootstrap 表上工作。可能是什么原因?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42682942/

相关文章:

html - 悬停按钮时防止文本颜色发生变化

javascript - Bootstrap 下拉菜单不适用于标准 JS 和 CSS

jquery - 恰好附加在某个标签之后

html - 如何更改移动布局上的 bootstrap 4 列顺序?

html - 查找 Xpath - 用于没有 HTML 标记的文本

html - 我想让导航栏保持在顶部,但是当我滚动时,导航栏会下降但在内容后面

twitter-bootstrap - 在 Orchard 中的 PJS.Bootstrap 默认 css 之后加载 custom.css

javascript - 如何通过 .html() jquery 方法传递标签内的变量?

java - w.a.用户名密码验证过滤器 : An internal error occurred while trying to authenticate the user

jquery - 如何在模态打开时隐藏移动地址栏?