0

I want set the table th font vertical center,but if It is not effect as I set in CSS like this:

.table-display th {
    height: 20px;
    font-size:13px;
    text-align:center;
    vertical-align:middle
}

and the html is:

<table id="rule-table"  class="table table-display table-striped  jambo_table" border="1" style="margin-bottom: 5px">
        <thead>
            <tr class="headings">
                <th>Name</th>
......

But if I set the vertical-align style in html instead of css,it took effect:

<table id="rule-table"  class="table table-display table-striped  jambo_table" border="1" style="margin-bottom: 5px">
        <thead>
            <tr class="headings">
                <th style="vertical-align:middle;">Name</th>
  ......

what is the problem?

Olaf Erlandsen
  • 5,817
  • 9
  • 41
  • 73
M.Mike
  • 663
  • 1
  • 6
  • 12
  • 1
    some css must be overriding this class And when u add inline css it will take effect. Check with developer tools in chrome. also try to use [!important](http://stackoverflow.com/q/9245353/4053389) in css. – abpatil Oct 28 '16 at 04:18

2 Answers2

0

You can use !important in your css class or try below code,

.table-display> thead> tr > th {
    height: 20px;
    font-size:13px;
    text-align:center;
    vertical-align:middle !important;
}
SilentCoder
  • 1,970
  • 1
  • 16
  • 21
  • Thank you for your answer. use !important in the css solved the problems.and there happens an other problem: Html: {{ value }} and the css: .table-display td { text-align:center; vertical-align:middle;!important; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; word-break:break-all;; } and .td-font-left{ text-align:left;!important; } td-font-left tooks no effect,font is still in center,how to sovle it? – M.Mike Oct 28 '16 at 06:12
  • `!important` should add before the semi colon(;). like - `.td-font-left{ text-align:left !important; }` – SilentCoder Oct 28 '16 at 06:37
0

You just need to give !important in the CSS file..That will work.This will override the other css.

Abdulsalam Khan
  • 57
  • 1
  • 10