Search code examples
vue.jselement-ui

How do I center the text in the header row of an element-ui table?


I tried centering the text in the header of my element-ui table via:

<el-table :data="myTable" header-row-style="text-align: center;">

Unfortunately, that doesn't have the desired effect. How do I center the names of the columns?


Solution

  • header-row-style takes an object or a function as an attribute value. it does not take a string.

    So you can try it

    <el-table :data="myTable" :header-row-style="{textAlign: 'center'}">