css - Django 列表不使用 css

标签 css django list models

您好,我在将 css 用于打印数据库中模型的所有对象的列表时遇到问题。我似乎无法更改用于列表中每个元素的字体大小

子模板文件

{% extends 'template.html' %}
{%block title %} View Music Packs {% endblock%}
{%block header %} View Music Packs {{page_name}}{% endblock%}

{% block body_block %}
<div id = "subtemplate">
<ul>
    {% for musicpack in object_list %}
        <li>
            {{musicpack.title}} - {{musicpack.composer}} - {{musicpack.arranger}}
        </li>
    {%empty %}
        <li> No musicpacks yet. </li>
    {% endfor %}
</ul>
</div>
{% endblock %}

CSS 部分

#subtemplate{
background: grey;
width :70%;
margin:0 auto;
margin-top: 20px;
border: solid orange 3px;
}

#subtemplate ul{
list-style-type: none;
font-size: normal 20px;
}

#subtemplate ul li{
font-size: normal 20px;
}

template.html 部分

<div id="main_section">
<h3> {%block header %} Template {% endblock %} </h3>

{% block body_block %}
This is just an empty Template
{% endblock %}

</div>

我怀疑我遗漏了一些东西,因为我在处理纯 html 文件时已经习惯了这一点,而且它工作正常。

最佳答案

here is a fiddle

 font-size: normal 20px;

不是正确的 css 语法

 font-weight: normal;
 font-size: 20px

改为这样做

关于css - Django 列表不使用 css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23632560/

相关文章:

list - Prolog:按替代索引对列表进行排序

html - 有没有办法在电子邮件模板中使用其他网站字体?

html - 页脚位置固定重叠页面内容

django - 在 Django 中的开发/实时数据库之间同步数据

python - Django - 使用属性作为外键

python - 将文件读入列表并去除换行符

css - 如何使图像在物化卡中使用其父级的全高

javascript - 使用回调函数动态加载样式表

django - 如何在 Django 测试中获取用户?

python - 是否有用于创建大小为 'n' 的随机数列表的内置函数?