How to display Django SelectDateWidget on one line using crispy forms How to display Django SelectDateWidget on one line using crispy forms django django

How to display Django SelectDateWidget on one line using crispy forms


Add this to your layout for your SelectDateWidget fields:

MultiWidgetField('field_name', attrs=({'style': 'width: 33%; display: inline-block;'}))


You can change the width for each of the three widget like this :

.selectdatewidget {    display: inline-block;}select[name$="_day"].selectdatewidget {    width: 27%;    color: red;}select[name$="_month"].selectdatewidget {    width: 38%;    color: green;}select[name$="_year"].selectdatewidget {    width: 35%;    color: blue;}

SelectDateWidget with three differents width