Inline Styling In PHP
I am styling a page that has PHP in the middle that echos out a table. I have the html centered through an external style sheet but the PHP section(where the table is wont center)
Solution 1:
You can use this but all tables will be centered
table {
margin: 0 auto;
}
or define a class to identify the specific table
table .customClass {
margin: 0 auto;
}
<table border='1' cellpadding='2' class='customClass footable mdl-data-table mdl-js-data-table mdl-data-table--selectable mdl-shadow--4dp full-width'>
or you can try using align="center"
<table align="center" border='1' cellpadding='2' class='footable mdl-data-table mdl-js-data-table mdl-data-table--selectable mdl-shadow--4dp full-width'>
Hope this might help you.
Solution 2:
The same style mark in the front will be covered. example:
<style>
th, td{
text-align: center;
}
th, td{
text-align: left;
}
</style>
Then the text would be display from left.
To solve the problem simply, you can try to add these code below all of the css links:
<style>
th, td{
text-align: center;
}
</style>
If it doesn't work, I suggest that you try this :-)
echo '<th style="text-align: center">' . $row['id'] . '</th>';
Post a Comment for "Inline Styling In PHP"