2👍
✅
You can do this.
email = forms.EmailField(label=_("E-mail"),
widget=forms.TextInput(attrs={'placeholder': 'Your Email', 'class':'your_css_code'}))
1👍
I was having issues with this as well, but then I realized that you don’t want to style the placeholder within your Django form. Just add the following css to your style sheet and you’ll be good to go.
::-webkit-input-placeholder {
color: rgba(255, 255, 255, .5);
}
:-moz-placeholder { /* Firefox 18- */
color: rgba(255, 255, 255, .5);
}
::-moz-placeholder { /* Firefox 19+ */
color: rgba(255, 255, 255, .5);
}
:-ms-input-placeholder {
color: rgba(255, 255, 255, .5);
}
- [Django]-RESTful API with model inheritance in Django
- [Django]-Can I deploy both python 2 and 3 django app with apache using mod_wsgi?
- [Django]-I/O operation on closed file in django with 'ImageKit'
- [Django]-How to get django form wizard extra_context to show on template?
- [Django]-Django annotation in a loop
Source:stackexchange.com