Reputation: 29
I am trying to get rounded cells for my table but I am unable to execute css as border-radius is not working in my code i.e.,
table
{
border-spacing: 10px;
border-collapse: seperate;
}
<tr>
<td style=\"border:1px solid black; background-color:#FE0000; color:white; text-align:center;\"><b>xxxxxxxxxxx</b></td>
<td style=\"border:1px solid black; background-color:#F69546; color:white; text-align:center;\"><b>xxxxxxxxxxx</b></td>
<td style=\"border:1px solid black; background-color:#92D14F; color:white; text-align:center;\"><b>xxxxxxxxx</b></td>
here I am using tcpdf and html
Upvotes: 2
Views: 4305
Reputation: 74
TCPDF has a very limited CSS support. It doesn't support all attributes.
Currently, only the following CSS attributes are supported:
font-family font-size font-weight font-style color background-color text-decoration width height text-align
Upvotes: 1
Reputation: 383
You should use php
singular quotes ' '
with html
with double quotes on attributes
" "
See : LINK (SO Question)
UPDATED: added table
opening and closing tags and tr
closing tag
change $html
to
$html ="
<table>
<tr>
<td style=\"border:1px solid black; background-color:#FE0000; color:white; text-align:center;\"><b>xxxxxxxxxxx</b></td>
<td style=\"border:1px solid black; background-color:#F69546; color:white; text-align:center;\"><b>xxxxxxxxxxx</b></td>
<td style=\"border:1px solid black; background-color:#92D14F; color:white; text-align:center;\"><b>xxxxxxxxx</b></td>
</tr>
</table>
";
to
$html ='
<table>
<tr>
<td style="border:1px solid black; background-color:#FE0000; color:white; text-align:center;"><b>xxxxxxxxxxx</b></td>
<td style="border:1px solid black; background-color:#F69546; color:white; text-align:center;"><b>xxxxxxxxxxx</b></td>
<td style="border:1px solid black; background-color:#92D14F; color:white; text-align:center;"><b>xxxxxxxxx</b></td>
</tr>
</table>
';
also try using this to echo the css if not already included.
$html = "table { border-spacing: 10px; border-collapse: seperate; }";
or
$html = "td b { border-spacing: 10px; border-collapse: seperate; }";
Upvotes: 0
Reputation: 1894
Give border-radius
for child element of the td .
td b{
border: solid 1px #ccc;
border-radius: 50%;
display:block;
padding: 10px;
width:100px;
height:100px;
}
<table>
<tr>
<tr>
<td style=\"border:1px solid black; background-color:#FE0000; color:white; text-align:center;\"><b>xxxxxxxxxxx</b></td>
<td style=\"border:1px solid black; background-color:#F69546; color:white; text-align:center;\"><b>xxxxxxxxxxx</b></td>
<td style=\"border:1px solid black; background-color:#92D14F; color:white; text-align:center;\"><b>xxxxxxxxx</b></td>
</tr>
</table>
Upvotes: 1