Can label be in the middle of el-table?

I set width or label to the left
is there any other way to center label in this column

clipboard.png


Hello, you can set the text center of the header by setting the class, of the header by setting the header-row-class-name property.
the following is the whole code

<template>
    <div>
        <el-table :data="data" header-row-class-name="center">
          <el-table-column label="" prop="name"></el-table-column>
          <el-table-column label="" prop="age"></el-table-column>
        </el-table>
    </div>
</template>

<script>
export default {
    data(){
        return{
            data: [
                {
                    name: '',
                    age: '18'
                }
            ]
        }
    }
}
</script>

<style>
.center th .cell{
    text-align: center !important;
}
</style>

: header-cell-style= "{'text-align':'center'}"


write the attribute align= "center" directly on the tag, which is for a single one. If it is all, it is recommended to use the first floor method

.
Menu