I tried to set a separate css class to overide the style of the dropdown menu. However, it's not working.
#form.py
class fundForm(forms.Form):
fund = forms.ChoiceField(choices=FUND, required=True, widget=forms.Select(attrs={'class': 'selectpicker .selectStyle'}))
class META:
model = fundList
#html
.selectStyle{
font-size: 5px
}
when you specify a class in the DOM, you do not use the .
, only for accessing it in CSS (or jQuery). change 'selectpicker .selectStyle'
to 'selectpicker selectStyle'
, that should do the trick.
fund = forms.ChoiceField(choices=FUND, required=True, widget=forms.Select(attrs={'class': 'selectpicker selectStyle'}))
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.