Home  >  Article  >  Web Front-end  >  How to set the html input size

How to set the html input size

奋力向前
奋力向前Original
2021-10-08 10:10:0751113browse

In HTML, you can set the input width and height by using the width attribute and height attribute to set its size. You only need to add the "width: width value; height: height value;" style to the input element. That is Can.

How to set the html input size

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

How to set the input size in html (steps)

1. Create a new html file named test.html for explanation How to use CSS to set the size of the text box and the maximum number of input characters.

How to set the html input size

#2. In the test.html file, use the input tag to create a text box of type text, and set its default value to empty.

How to set the html input size

Code effect

How to set the html input size

3. In the test.html file, use the maxlength attribute to set the input box to a maximum of only Can enter 10 characters.

How to set the html input size

4. In the test.html file, write a tag, and the css style of the page will be written in the tag.

How to set the html input size

5. In the css tag, set the css style of the input element through its name, use the width attribute to set the width of the input to 300px, and use the height attribute to set the height of the input to 30px. .

How to set the html input size

#6. Open the test.html file in the browser to check the effect.

How to set the html input size

Recommended learning: HTML video tutorial

The above is the detailed content of How to set the html input size. For more information, please follow other related articles on the PHP Chinese website!

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