繁体   English   中英

Joomla仅加载CSS模板的某些部分

[英]Joomla loads only certain parts of css template

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

当我将所有设计留在css中时,似乎只加载了与css类有关的那些部分,并且不执行其他任何操作,因此最终我不得不将其他所有内容都写入de index.php中,这很愚蠢,因为Im不应该这样做。

例如,这是我想要给我的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");

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM