input width Attribute - HTML CSS HTML Tag

HTML CSS examples for HTML Tag:input

Description

The width attribute specifies the width of the <input> element.

The width attribute is used only with <input type="image">.

Attribute Values

Value Description
pixels The width in pixels (e.g. width="100")

The following code shows how to Define an image as the submit button, with height and width attributes:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<form action="/action_page.php">
  First name: <input type="text" name="fname"><br>
  Last name: <input type="text" name="lname"><br>
  <input type="image" src="img_submit.gif" alt="Submit" width="48" height="48">
</form><!--from   w ww  .j a v  a  2  s.  com-->

</body>
</html>

Related Tutorials