Height and Width Attribute
The height and width attributes specify the height and width of an <input> element.
height="pixels"
Specifies the height of the button image when the input type is set to "image".
width="pixels"
Specifies the width of the button image when the input type is set to "image".
Note: These attributes are used with input="image" only.
It is always necessary to specify both the height and width attributes for images. If the height and width are set then the space required for the image is reserved when the page is loaded.
Syntax
<input type="image" src="someimage.jpg" width="pixels" height="pixels" />
Browser Support
It is supported in all major browsers such as Chrome, Internet Explorer, Firefox, Opera and Safari.
Example
- <!DOCTYPE html>
- <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta charset="utf-8" />
- <title>Height and Width Attribute</title>
- </head>
- <body>
- <h3>HTML5 Height and Width Attribute</h3>
- <form action="form.asp">
- First name:
- <input type="text" name="fname"><br>
- Last name:
- <input type="text" name="lname"><br>
- Email:
- <input type="email" name="email"><br>
- <input type="image" src="D:\Ashwani\images.jpg" alt="Submit" width="90" height="50">
- </form>
- </body>
- </html>
Output

List Attribute
The list attribute refers to a <datalist> tag that contains pre-defined options for an <input> element. The list attribute enables the user to associate a list of options with a particular field.
The <datalist> tag is a list of options that will display a simple text field that drops down a list of suggested answers when focused. The <datalist> is new in HTML5.
Syntax
<inputtype="text"list="characters">
Browser Support
It is supported in all major browsers such as Chrome, Internet Explorer, Firefox and Opera except Safari.
Example



Comments
Join the conversation! Your thoughts help the community grow.