I am working on a html/css/javascript program which you can solve sudokus that the program generates, like an online puzzle book. Because of this, I have a lot if <input />
tags (81 to be precise) for unique id's for each one. But I have also had to write the maxlength
attribute for each <input />
tag that I wrote.
I am wondering if you can do this in css instead. Can you have attributes other that style attributes (such as border
or margin
) in CSS? If so, how do you reference them? I've tried to type it directly in, but it appears that it does not exist.
My examplar input tag: <input id="00" type="text" onclick="checkIfBold('00')" maxlength="1"/>
The CSS for the tag:
input {
border: 0px solid #000;
width: 100%;
height: 100%;
font-size: 200%;
text-align: center;
}
My aim is to set the maxlength
attribute of the <input />
element by using CSS.
Note that I am not just asking about this specific attribute, I am asking how to reference any other html attribute in css (if possible)?