我是 smarty 的新手,所以我不确定这是否会导致我遗漏某些内容,但目前我正在尝试从 css 文件中提取一个类。
到目前为止,我已经设置了 2 个类 mainbackground
和 body
,mainbackground
旨在只是一种背景颜色,但它没有得到任何我添加到 css 的值的一部分,而 body
css 详细信息提供给其中的 div。
谁能看看我是不是做错了什么?
CSS:
@charset "utf-8";
/* CSS Document */
mainbackground{
background-color:#000
}
body{
margin-top:20px;
margin-left:auto;
margin-right:auto;
width:80%;
}
HTML(tpl 文件):
<link href="/templates/css/main.css" rel="stylesheet" type="text/css" />
<div class="mainbackground">
<div class="body">
<div align="center">
<img src="../images/Logo.jpg" width="279" height="215" longdesc="#" />
</div>
</div>
</div>
最佳答案
您的 CSS 语法无效。类必须以点为前缀:
@charset "utf-8";
/* CSS Document */
.mainbackground{
background-color:#000
}
.body{
margin-top:20px;
margin-left:auto;
margin-right:auto;
width:80%;
}
如果没有点,它将引用标签名称。 ID 将使用#sign
引用关于html - smarty tpl 文件没有正确读取 tpl 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33260397/