【发布时间】:2021-03-22 05:28:32
【问题描述】:
我的问题是:我想用 css 在 Django 模板中做一个条件,但它没有用。
<label>{% if not typ.required %}
{% trans 'Bitte Auswahl treffen' %}{% endif %}</label>
<input type="checkbox" {% if typ.required %} style="display:none;" checked="checked"
{% endif %} name="checkbox"
data-toggle="toggle" id="{{ typ.typ_id }}"
value="{{ cookie_id }}" />
{% if typ.required %} style="display:none;" checked="checked"{% endif %}
checked="checked" 有效,但 Style 无效。
如果我按 f12 观看网站,我会在输入类型中看到这种风格
谢谢大家
【问题讨论】:
标签: html css django django-templates