在标记的样式属性中时未解释CSS


CSS not interpreted when in the style property of a tag

我的问题是当我把内联CSS放在这样的标签中时:

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

这只是一个例子,而不是导致问题的原因。

第二个属性,这里是color: red;,当我在PHP变量中使用它来稍后用HTML2PDF生成pdf时,它不会被解释。

$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使用冒号来定义值。您似乎多次使用等号来定义值。

更改此颜色:红色<div style='border : 1.5px solid black; color:red;'>...</div>