How to set the length of html text box

奋力向前
Release: 2021-10-06 19:58:49
Original
26034 people have browsed it

In HTML, you can use the width attribute to set the length of the text box. This attribute can set the width of the element. You only need to add the "width: length value length unit;" style to the text box element.

How to set the length of html text box

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

How to set the length of the text box in html

1. Create a new html file and name it test.html to explain how to use it. CSS adjusts the length of the text box.

How to set the length of html text box

2. In the test.html file, create two text boxes using the input tag within the p tag, as shown below.

How to set the length of html text box

3. In the test.html file, set the id attributes of the two input boxes to one and two respectively. It is mainly used to set the css style through the id below.

How to set the length of html text box

##4. In the test.html file, write the tag, and the css style of the page will be written within this tag.

How to set the length of html text box

5. In the css tag, set the style of the input tag with id one, and use the width attribute to define its length as 100px.

How to set the length of html text box

#6. In the css tag, set the style of the input tag with id two, and use the width attribute to define its length as 200px.

How to set the length of html text box

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

How to set the length of html text box

Recommended study: "

html video tutorial"

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

Related labels:
source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!