Possible Duplicate:
Can I specify maxlength in css?
In my CSS I use this code to make round borders for all the input tags in my site. I wonder if it is possible to limit the lenght of the input in the same way (for example 50 characters)
input
{
border-radius: 10px;
-moz-border-radius: 10px;
-khtml-border-radius: 10px;
-webkit-border-radius: 10px;
}
I imagine something like (this is not working):
input
{
max-lenght: 50;
}
Any sugestions? Thank you very much!
EDIT: This question is about how many characters can the user write into the field, not the visible size of the input
Complete HTML/CSS Course 2022 To give a limit to the input field, use the min and max attributes, which is to specify a maximum and minimum value for an input field respectively. To limit the number of characters, use the maxlength attribute.
You can specify a minimum length (in characters) for the entered value using the minlength attribute; similarly, use maxlength to set the maximum length of the entered value, in characters.
You cannot use CSS to limit the number of input characters. That would be a functional restriction, and CSS deals with presentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With