While generating an Excel sheet through PHP, CSS is not working. What could be a solution?

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Ok here’s what I want you to try:

In your header section put this:

<style>

.table-style{

height = auto;

width = auto;

border: 2px solid black;

}

</style>

In your table add the class table-style

<?php
for($i=0;$i<2;$i++)
{
echo “<table class= “ /‘ table-style /‘ ” >”;
echo “<tr>”;
echo “<td>”; echo some data; echo”</td>”;
echo “<td>”; echo some data; echo”</td>”;
echo “<td>”; echo some data; echo”</td>”;
echo “</tr>”;
echo “</table>”;
}

You were adding an inline style only supplying the height and width

You were not escaping the quotes in the string.

Off the top of my head this is something that should work. When you see the black border around everything in the table you will know that the styles are kicking in.

If you still are having problems, send me a link to the site or all the code including the style sheet and I will fix it for you.

Good luck,

Tom
See Questions On Quora