简体   繁体   中英

Django Template Condition with css

my Question is: I want do a condition in Django Template with css but it didnt work.

<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" works but the Style not.

If i press f12 to watch the site i see this style in the input type

Thank you guys

i find the solution. The div above overwrite the style of the checkbox:-)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM