Recently, I used the size and MaxLength attributes of the input in the project. I only used to look at the difference between the two tags before. This weekend, baidu understood it. Record here!
Copy code
The code is as follows:
<p>Name: <input type=”text” name=”fullname” maxlength=”5″ /></p>
<p>Name2: <input type=”text” name=”fullname” size=”5″ /></p>
<p>Name2: <input type=”text” name=”fullname” size=”5″ /></p>
MaxLength = 5 “, only 5 characters can be input in the input input box < br / >
It means that the input box only displays five visible characters, but you can input ‘countless’ multi character content
That is, the size attribute specifies the width of the input field (here, the Name2 text box only displays the width of 5 characters),
Since the size property is a visual design property, we should replace it with width in CSS.
CSS syntax: < input style=“ width:100px / >