php html渲染忽略样式

标签 php html css

我会尽量解释清楚这一点。我有以下变量

$name = 主 channel 和 $childs = 子 channel ,如果我从 HTML 中删除子 channel ,则主 channel 显示而不是子 channel ,这是正确的。但是当我尝试将子 channel 设置为不同的颜色时,它不会允许它,如果你注意到我有 2 个不同的图像,但它会忽略子 channel 图像并使用主要且仅使用。我不明白如何在不影响主 channel 的情况下删除子 channel ,但是当我尝试向子 channel 添加单独的图标和 css 时,它会完全忽略它。

private function renderChannels($channelId)
        {
            $content = "";
            $imagePath = $this->imagePath;
            foreach ($this->_channelDatas as $channel)
            {
                if($channel["pid"] == $channelId)
                {
                    if($channel["show"])
                    {
                        $name = $this->toHTML($channel["channel_name"]);
                        $title = $name  . " [" . $channel["cid"] . "]"; 

                        $link = "javascript:tsstatusconnect('" . $this->_javascriptName . "'," . $channel["cid"] . ")";                 

                        $users = $this->renderUsers($channel["cid"]);
                        $childs = $this->renderChannels($channel["cid"]);


                        $cid = $channel["cid"];

                        $content .= <<<HTML
            <div class="comms-row comms-row-title">  
            <img src="resources/media/icons/sub_channel_icon.png">$name
            <div class="comms-row-flags">$flags</div>
            $users
     <div class="comms-row"><img src="resources/media/icons/sub_channel_icon.png">$childs</div>
    </div>  
    HTML;   

最佳答案

Us CSS !important 子 channel 中的重复声明。我注意到 Fire fox 的较新更新忽略了稍后重新声明的声明。我不知道为什么。 !important 会起作用,但我相信有更好的方法来做到这一点。

关于php html渲染忽略样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37009137/

相关文章:

html - CSS:mozilla 浏览器中的文本位置不正确

html - 可悬停的侧面导航

javascript - 如何使用 JavaScript 更改所有网站页面的正文背景颜色?

html - 纯CSS(无JS)方式判断是否选中多个复选框

html - 如何在内容 DIV 处停止粘性页脚

html - 使用 Bootstrap 4 垂直对齐卡片中的元素

php - MySQL 表未在 UPDATE 查询上更新(来自 Facebook 图形调用)

php - 将逗号分隔值插入 MYSQL + 附加表单数据

php - 当同一行中的值等于变量时,如何更新特定列?

php - 我如何删除此错误 : PDOException: SQLSTATE[HY093]: Invalid parameter number: parameter was not defined