English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
HTML input width-Eigenschaft legt die Breite des <input>-Elements fest, die width-Eigenschaft ist nur für <input type="image"> gültig. Wenn height und width gesetzt sind, wird beim Laden der Seite der erforderliche Raum für das Bild beibehalten.
Definieren Sie das Bild als Submit-Button, die Größen der Eigenschaften height und width:45Pixel:
<!DOCTYPE html> <html> <head> <title>HTML: <input> width-Eigenschaft - Grundlagen-Tutorial-Website(oldtoolbag.com)</title> <body> <form action="action_page.php"> Vorname: <input type="text" name="fname"><br> Nachname: <input type="text" name="lname"><br> <input type="image" src="img_submit.gif" alt="Submit" width="45"height="45"> </form> </body> </html>Test it out ‹/›
IEFirefoxOperaChromeSafari
All major browsers support the width attribute.
The width attribute specifies the width of the <input> element.
Note:The width attribute is only applicable to <input type="image">.
Tip:Always specify both the height and width attributes of the image. If height and width are set, the space required for the image is reserved when the page is loaded. However, if these attributes are not set, the browser will not know the size of the image and will not be able to reserve the appropriate space. The effect is that the page layout will change during loading (when the image is loading).
The width attribute is an HTML5 New attribute of the <input> tag in the <input> tag.
<input width="pixels">
Value | Description |
---|---|
pixels | Width in pixels (e.g. width="100")。 |