Can I specify maxlength in css?

Solution 1:

No.

maxlength is for behavior.

CSS is for styling.

That is why.

Solution 2:

No. This needs to be done in the HTML. You could set the value with Javascript if you need to though.