Search code examples
phphtmlcsshtml2pdf

CSS not interpreted when in the style property of a tag


My problem is when I put inline CSS in a tag like this:

<div style='border : 1.5px solid black; color:red;'>...</div>

This is just an example not the one which causing the issue.

The second property, here color: red;, is not interpreted when I use it in a PHP variable to generate a pdf later with HTML2PDF.

$content2 = "<html>
                <head>
                       ...
                </head>
                <body>
                    <h3 style='margin-bottom: 0px;'>".$design."</h3>
                        <div style='margin: 15px;'>&nbsp;<strong>".$taille."</strong>&nbsp;-&nbsp;<i>".$scient."</i><br /></div>
                        <div style='border : 1.5px solid black; width:100px;'><img src='".$chemin."' style='width: 100px;' /></div><p style='margin-top : -75px; margin-right : -250px;'>origine :".$origine."</p>

                </body>
            </html>
 ";

Please help me into this.


Solution

  • CSS uses colons to define values. You seem to be using the equals sign multiple times to define values.