CSS 在标签的 属性 样式中不被解释

CSS not interpreted when in the style property of a tag

我的问题是当我将 inline CSS 放入这样的标签中时:

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

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

第二个 属性,此处 color: red;,当我在 PHP 变量中使用它稍后生成 pdf 时,它没有被解释使用 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>
 ";

请帮我解决这个问题。

CSS 使用冒号定义值。您似乎多次使用等号来定义值。

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