Page 1 of 1

How to align table view all in center and in the middle of the cell?

Posted: 2018-01-10 22:11
by Vasil Vasilev
Hi,
I would like to align table view in the center and in the middle of the cell. I want also to do it with the header (it is always stuck on the left). I read that I can only do it with jquery. Can someone explain to me how to do it. The best way to understand it is with example. I have very basic knowledge of programming so I would ask, the explanation to be more detailed.

Thanks in advance!

Re: How to align table view all in center and in the middle of the cell?

Posted: 2018-01-22 09:25
by R Tammam
Hello Vasil Vasilev,

yes you can use Jquery and it's code is so simple
1- create a table and name it tablename-tv,js
and insert the following code in it

j(function(){

$j(' tr th').css("text-align","center");
$j(' tr td').css("text-align","center");
})

it works with me

Hope it would help you :)

Regards ,
Reham

Re: How to align table view all in center and in the middle of the cell?

Posted: 2018-02-12 08:42
by xbox2007
hello
thanks for your code ,

BUT
i try this code , its not working with table view , its work only with table details ???

any support ??

Re: How to align table view all in center and in the middle of the cell?

Posted: 2018-02-12 09:25
by xbox2007
hello

i add this code in (( footer-extras.php ))

and work with me very fine , ,,,,

thanks a lot

Code: Select all

<style>

.table > thead > tr > th,
.table > tbody > tr > th,
.table > tfoot > tr > th,
.table > thead > tr > td,
.table > tbody > tr > td,
.table > tfoot > tr > td {
  padding: 8px;
  line-height: 1.42857143;
  vertical-align: top;
  border-top: 1px solid #ddd;
  text-align: center; 
  vertical-align: middle;
}



  
</style>


Re: How to align table view all in center and in the middle of the cell?

Posted: 2018-02-28 05:34
by R Tammam
Sorry for the late reply , and happy to see your code working <3