Home > Web Front-end > CSS Tutorial > How to set css input size

How to set css input size

青灯夜游
Release: 2023-01-05 16:12:09
Original
14874 people have browsed it

In CSS, you can use the width and height attributes to set the size of the input element. You only need to add the "width: width value; height: height value;" style to the input element. Input is an inline replacement element, and its effect is equal to that of a block element, so the width and height values ​​can be set.

How to set css input size

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

In CSS, you can use the width and height attributes to set the size of the input element.

Code example:

<form action="form_action.asp" method="get">
  用户名: <input type="text" name="name" style="width: 100px;height: 30px;"/><br /><br />
  密码: <input type="password" name="password" /> <br /><br />
 <input type="submit" value="Submit" />
</form>
Copy after login

Rendering:

How to set css input size

##Description:

  • tag is used to collect user information. It is an inline replacement element. height/width/padding/margin are all available. The effect is equal to the block element.

    However, for inline non-replacement elements, height/width/padding top, bottom/margin top, and bottom have no effect. You can only use padding left, right and margin left, right to change the width.

  • The width attribute sets the width of the element, and the height attribute sets the height of the element.

    The width and height attributes define the width and height of the element's content area, excluding padding, borders, or margins; padding, borders, and margins can be added outside the content area.

(Learning video sharing:

css video tutorial)

The above is the detailed content of How to set css input size. 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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template