Can I replace the maxlength attribute with something in CSS?
I don't think you can, and CSS is supposed to describe how the page looks not what it does, so even if you could, it's not really how you should be using it.
Perhaps you should think about using JQuery to apply common functionality to your form components?
No. This needs to be done in the HTML. You could set the value with Javascript if you need to though.
Use $("input").attr("maxlength", 4)
if you're using jQuery version < 1.6
and $("input").prop("maxLength", 4)
if you are using jQuery version 1.6+.
Not with CSS, no.
Not with CSS, but you can emulate and extend / customize the desired behavior with JavaScript.
You can use jQuery like:
$("input").attr("maxlength", 4)
Here is a demo: http://jsfiddle.net/TmsXG/13/