我会尽量解释清楚这一点。我有以下变量
$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/