3

I am currently learning Django Framework with django-autocomplete-light 3.1.3 and i can't find any way to change the css of a input field.

In there documentation it is written that we can create our own HTML template de deal with the data but can we just change a little bit the css of an input box ?

I've try to add my own classes to the element before creation with widget-tweaks but every styling attribute is being cancel by the default of django-autocomplete-light.

I really just want to set the size of the box to 100% of the parent element and I've been stuck here for 2 days...

Thanks a lot

  • What have you tried so far? I was able to change the styling of the elements by including my own CSS file with modifications to the elements I was interested in (based on the names that I found using dev tools to inspect elements). I needed to add !important to it to have it override the Select2 CSS. Maybe I could help if you could specify what the desired behaviour is, i.e. what elements you want to change. You can also add a style attribute to the `attrs` argument of the widget like so `attrs={'style':'width:500px')` to make some changes, but keep in mind this might not be the right element. – Mihai Chelaru Feb 17 '19 at 22:41

1 Answers1

2

In my css file I had to overwrite the ccs class:

.select2-container {
    min-width: 15em !important;
}
Omarbeat
  • 249
  • 2
  • 6