【发布时间】:2011-12-25 08:59:54
【问题描述】:
所以我有一个普通的 html 文件,带有诸如等标签。
我有这个 css 文件:
html, body {
margin:0;
padding:0;
backgound-color:blue;
}
a {
/* Note: For whatever reason this does not apply to templates/tags/naviagtion.html */
text-decoration: none;
}
无论出于何种原因,当它通过以下方式应用于我的 html 文件时:
<link rel="stylesheet" type="text/css" href="/static/css/base.css" />
注意:放在base.html中,它是基本模板。正文的背景和链接的文本装饰不会更改为 css 样式。其他标签如 div 将其宽度、浮动等更改为 base.css 文件的样式。当我通过标签中的 style="" 亲自编辑标签时,将应用属性。为什么样式是使用 style="" 而不是从 css 文件中应用的。我在 base.html 文件中没有覆盖任何内容的内联 css。此外,html 的边距和填充、css 文件中的 body 等属性会被应用,而 background-color 则不会。怎么回事?
谢谢!
base.html 文件看起来很像这样
....
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/base.css" />
</head>
<body>
<!--
<div class="left_holder" >
</div>
-->
<div class="center_holder" >
<div id="top_1" >
<div id="search" class="top_left" >
<!-- [ searchbar ] -->
{% include "tags/search.html" %}
</div>
....
navigation.html 文件:
<div><a href="/" >Home</a></div>
抱歉,没有网址,因为这是在本地主机上
【问题讨论】: