bootstrap-flask icon indicating copy to clipboard operation
bootstrap-flask copied to clipboard

Horizontal align per table column

Open PanderMusubi opened this issue 5 years ago • 1 comments
trafficstars

Please support horizontal align for rendering of td in tables, similar to how table header titles are overridden.

Default is align left, as is now. User should be able to override that explicitely with align left, center and right. Only the td of a column are affected, not the th.

For example render_table(colum_align=[('id', 'right'), ('status', 'center')]) which will keep the other columns aligned left.

Optionally, also support overiding vertical align per column, e.g. colum_align=[..., ('status', 'center,vtop/vcenter/vbottom')] or something more approprite.

PanderMusubi avatar Aug 20 '20 09:08 PanderMusubi

I think there is no such need in most cases, but it apparently would increase the complexity of the code. I recommend you can achieve that with some css:

<style>
...
tr td:nth-child(2) {
    text-align:center;
    vertical-align:middle;
}
...
</style>

yuxiaoy1 avatar May 15 '21 04:05 yuxiaoy1

Did not know https://www.w3schools.com/cssref/sel_nth-child.asp Thanks, this is enough to close this issue.

PanderMusubi avatar Aug 27 '22 12:08 PanderMusubi