Home >Web Front-end >HTML Tutorial >Self-understanding of the difference between the size and maxlength attributes of Input_HTML/Xhtml_Web page production
Self-understanding of the difference between the size and maxlength attributes of Input_HTML/Xhtml_Web page production
WBOYOriginal
2016-05-16 16:39:531734browse
I recently used the size and maxlength attributes of input in a project. I used to just use them without paying attention to the difference between these two tags. I did some Baidu this weekend and I have some understanding. Specially recorded here!
Copy code
The code is as follows:
Name:
Name2:
maxlength="5", then only 5 characters can be entered in the input box
size="5", which means The input input box only displays 5 visible characters, but you can enter 'countless' multi-character content
That is: the size attribute specifies the width of the input field (here the Name2 text box only displays 5 characters in size) width), Since the size attribute is a visual design attribute, we should use the width in CSS to replace it.
CSS syntax:
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn