How to set the input box size in HTML

How to set the size of the input box in HTML

The size of the input box defined by the HTML input element can be set through the width attribute and height attribute of CSS to set the width and height of the input box respectively. If you only set these, the font in the input input box will not change in size accordingly. If you need to set the font size in the input input box, you need to set it separately. The following example will first introduce the setting method of changing the size of the input box. The syntax is as follows:

input{width:value1;height:value2}

Tip : input is an element selector, and other selectors can also be used, such as id selector, class selector, etc.

Example code for setting the size of the input box in HTML, and an online editor

<input type='text'><br><br>
<input type='text' id='inp'>

<style>
  #inp{width:100%;height:50px;}
</style>
Original text and online editor: How to set the size of the input box in HTML, examples are online

Guess you like

Origin blog.csdn.net/weixin_47378963/article/details/129775518