1

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

Alive to die - Anant
  • 70,531
  • 10
  • 51
  • 98
siva sanker
  • 19
  • 1
  • 5

3 Answers3

1

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>
Krish
  • 1,884
  • 2
  • 16
  • 40
  • this code is working in palin html but in TCPDF conversion is not working specially border radius it shows only rectangle box. – siva sanker Feb 05 '16 at 10:04
  • This html code was copied from you question, then why? Give a width and height for the element and give border-radius, then it will be rounded element. answer is updated please check. – Krish Feb 05 '16 at 10:15
0

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; }";
Community
  • 1
  • 1
Jamie Harding
  • 383
  • 3
  • 22
0

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

Dev
  • 64
  • 6