php - 在标签的样式属性中时不解释 CSS

标签 php html css html2pdf

我的问题是当我将 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 变量中使用它以稍后使用 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 使用冒号来定义值。您似乎多次使用等号来定义值。

关于php - 在标签的样式属性中时不解释 CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33388407/

相关文章:

php - 使用 $_GET 的 PDO 查询生成 SQL 语法错误

javascript - 动态创建的li点击事件不起作用jquery

html - Bootstrap 垂直居中内容在行中

javascript - Creating a HTML form with selector 已保存的 SQL 十六进制颜色的选择器

javascript - 需要 Bootstrap 列帮助

javascript - 使用 javascript 创建一个新元素

php - 有什么是 PHP with CodeIgniter 可以做而 Ruby on Rails 3 不能做的吗?

php - 如何在不安装 Apache 2 的情况下卸载 php7.2-fpm(在 LEMP 机器上)

php - 隐藏所有没有mysql数据库结果的html表

php - CSS 在 IE 中根本不显示,但在 Chrome 上工作(使用 CodeIgniter)