mardi 29 septembre 2020

Formatting checkboxes in django

i'm trying to add some checkboxes into my form and to make them look nice. The thing is that when I use the output is like: Checkboxes

I would like to have them inline and readable, unfortunately using crispy forms renders them too close to each other.

I found that looping through elements will place them inline but still they're close to each other (their labels are much longer than shown below).


enter image description here

Where to put my css in this case?

filters.py:

    weights = django_filters.MultipleChoiceFilter(
        label = "Filter by weight",
        required=False,
        widget=forms.CheckboxSelectMultiple,
        choices=OZ,
        method = 'filter_by_checkbox'
    )

Adding directly into static/css won't work :

   input[type=checkbox]
  {
   padding: 20px;
   margin: 20px 15px 0px 3px;
  }



Aucun commentaire:

Enregistrer un commentaire