el-table居中显示
时间: 2023-10-07 10:10:04 浏览: 113
要使el-table居中显示,你可以在el-table-column中使用align='center'来将单个表格的内容居中显示。例如:<el-table-column label="名称" prop="nickName" align="center"></el-table-column>
如果你想要整个表格都居中显示,你可以在el-table组件上设置header-cell-style和cell-style属性为{'text-align':'center'}来将表格的标题和单元格内容都居中显示。例如:<el-table :data="tableData" :header-cell-style="{'text-align':'center'}" :cell-style="{'text-align':'center'}" style="width: 100%"></el-table>
此外,如果你只想要单元格内容居中显示,你可以在el-table组件上设置cell-style属性为{'text-align':'center'}。例如:<el-table :data="tableData" :header-cell-style="{'text-align':'center'}" :cell-style="{'text-align':'center'}" style="width: 100%"></el-table> <span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [el-table中表头和内容文本居中](https://blog.csdn.net/weixin_73318685/article/details/129518573)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* [el-table 居中显示](https://blog.csdn.net/EsquireY/article/details/126484048)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文