html - 带有 css 的 Django 模板条件
问题描述
我的问题是:我想用 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;" 已检查=“已检查”{% endif %}
checked="checked" 有效,但 Style 无效。
如果我按 f12 观看网站,我会在输入类型中看到这种风格
感谢你们
解决方案
我找到了解决方案。上面的 div 覆盖了复选框的样式:-)
推荐阅读
- java - 如何防止**“java.net.ProtocolException:读取输入后无法写入输出”** Java 中的错误代码?
- android - 如何处理共享相同视图模型和实时数据的片段导致两个片段上的相同操作?
- azure - Azure Databricks 作业通知电子邮件
- javascript - 遍历 JSON 对象以映射列名和值
- android - ViewModel 类不断返回 Runtime 和 IllegalAccessException
- node.js - 纱线警告“ > bootstrap@4.xx”具有未满足的对等依赖性“jquery@1.9.1 - 3”
- java - 在从另一个线程读取期间是否可以读取非易失性变量的陈旧值?
- angular - Angular 的虚拟 ngFor 去哪儿了?
- sql - SQL扩展表以合并具有重复数据的字段
- maven - Maven两个不同属性的jar文件