html - 如何使数据表中的内容居中
问题描述
我有一个数据表,里面有一个 css 正方形<td>
,我想居中,但我不知道该怎么做。
未对齐正方形的图像:
到目前为止我已经尝试过:
th.dt-center, td.dt-center { text-align: center; }
columnDefs: [ { className: 'text-center', targets: '_all' }, ]
我也试过:
<th style="text-align:center;"></th>
<td style="text-align:center;"></td>
它适用于<th>
但不适用于<td>
我也尝试了这里提供的解决方案
"columnDefs": [
{"className": "dt-center", "targets": "_all"}
]
到目前为止,我还没有设法以任何方式使广场居中
解决方案
margin: 0 auto;
应该在.square
课堂上工作。
推荐阅读
- mysql - 通配符 LIKE 是否比 MySQL 中的多个布尔搜索更高效?
- php - 使用 CollectionType 时无法保存实体
- ruby - Capybara / RSpec 确保页面上任何地方都不存在某些东西
- html - 有没有办法将“a”标签链接取消设置为默认颜色
- julia - 具有通用函数成员的结构数组?
- heroku - 即使它在 requirements.txt 文件中,Heroku 也不会安装模块 psycopg2
- intellij-idea - IntelliJ PlantUML 插件不检测 *.pu 文件
- ruby-on-rails - 如何通过 application.html.erb 将引导闪存消息添加到整个应用程序?
- node.js - 如何进行单用户认证和授权?或者如何限制在 node js 中注册到应用程序的用户数量?
- sql - SQL 根据列条件检索行