HTML input Tag width Attribute Tutorial

In this section, we will learn what the width attribute is and how to use it.

What is width Attribute in HTML <input> Tag?

HTML <input> of type “image” is used to bring an external image to be used as a submit button. This image, by default, will be displayed by its standard width. But this width might be out of the scale we need in our document.

For this reason, we can use the width attribute to change the width to our specific need.

The value we set for this attribute is any number with relative or absolute units supported in HTML.

HTML width Attribute in <input> Tag Syntax:

<input type = “image” width = “value”>

Example: using width attribute in HTML <input> tag

See the Pen using width attribute in HTML <input> tag by Omid Dehghan (@odehghan) on CodePen.

Leave a Reply