gpt4 book ai didi

css - Joomla 只加载 css 模板的某些部分

转载 作者:行者123 更新时间:2023-11-28 13:22:46 28 4
gpt4 key购买 nike

我正在开发 Joomla!模板,我有我的索引和我的 template.css

当我将所有设计留在 css 中时,它似乎只加载那些与 css 类相关的部分而没有做任何其他事情,所以最终我不得不将其他所有内容写入 de index.php,这很愚蠢,因为我不应该这样做。

例如,这是我想要的 index.php 代码

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" >
<head>
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/posgradostemplate/css/template.css" type="text/css" />
<jdoc:include type="head" />
</head>
<body>
<div id="wrapper">
<div id="content">
<div class="mainmenu">
<jdoc:include type="modules" name="mainmenu" />
</div>
</div>
</div>
</body>
</html>

但是包装器和内容的行为与预期不符,并且没有显示背景。这是我的 CSS 文件:

html {

/* IE10 Consumer Preview */
background-image: -ms-linear-gradient(top, #E6E6E6 0%, #858585 100%);

/* Mozilla Firefox */
background-image: -moz-linear-gradient(top, #E6E6E6 0%, #858585 100%);

/* Opera */
background-image: -o-linear-gradient(top, #E6E6E6 0%, #858585 100%);

/* Webkit (Safari/Chrome 10) */
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #E6E6E6), color-stop(1, #858585));

/* Webkit (Chrome 11+) */
background-image: -webkit-linear-gradient(top, #E6E6E6 0%, #858585 100%);

/* W3C Markup, IE10 Release Preview */
background-image: linear-gradient(to bottom, #E6E6E6 0%, #858585 100%);
margin: 0;
padding: 0;
border: 0;
}

html, body {
height: 100%;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}

body {
margin: 0;
}


.mainmenu ul {
font-family: Arial, Verdana;
font-size: 12px;
margin: 0;
padding: 0;
list-style: none;
}
.mainmenu ul li {
display: block;
position: relative;
float: left;
}
.mainmenu li ul {
display: none;
}
.mainmenu ul li a {
display: block;
text-decoration: none;
color: #ffffff;
border-top: 1px solid #000000;
padding: 5px 15px 5px 15px;
background: #000000;
margin-left: 1px;
white-space: nowrap;
}
.mainmenu li:hover li a:hover {
background: #FFFF00;
color: #FF0000;
}
.mainmenu ul li a:hover {
background: #000000;
color: #FFFF00;
}
.mainmenu li:hover ul {
display: block;
position: absolute;
}
.mainmenu li:hover li {
background: #FFFF00;
float: none;
font-size: 11px;
color : #000000;
}
.mainmenu li:hover a {
background: #FFFF00;
color : #000000;
}


#wrapper{
width: 100%;
text-align: center;
}

#content{
display: inline-block;

}

除了 mainmenu 之外的所有东西都没有按照 css 告诉它的那样工作。我在想它没有被正确加载,我希望它被急切地加载,所以一切都在脑海中。现在它只有在我在索引中添加 css 代码时才有效,但它不应该那样。有什么建议吗?

最佳答案

尝试使用以下方法加载 CSS 文件:

$document = JFactory::getDocument();
$document->addStyleSheet(JURI::root() . "templates/posgradostemplate/css/template.css");

关于css - Joomla 只加载 css 模板的某些部分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14491122/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com