English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Die HTML-input-placeholder-Eigenschaft gibt eine kurze Beschreibung der erwarteten Werte für das Eingabefeld an (z.B. Beispielwerte oder eine kurze Beschreibung des erwarteten Formats). Diese kurze Beschreibung wird im Eingabefeld angezeigt, bevor der Benutzer einen Wert eingibt.
Zwei Input-Textfelder mit Placeholder-Text:
<!DOCTYPE html> <html> <head> <title>HTML:<input> placeholder-Eigenschaft - Grundlagen-Tutorial-Website(oldtoolbag.com)</title> <body> <form action="action_page.php"> <input type="text" name="fname" placeholder="Vorname"><br> <input type="text" name="lname" placeholder="Nachname"><br> <input type="submit" value="Submit"> </form> </html>Test See ‹/›
Text mit Placeholder-Farbe kann ebenfalls angegeben werden.
Text mit Placeholder-Farbe einstellen:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Grundlagen-Tutorial-Website(oldtoolbag.com)</title> </head> <body> <form action="demo-form.php"> <input type="text" name="fname" placeholder="Vorname"><br> <input type="text" name="lname" placeholder="Nachname"><br> <input type="submit" value="提交"> </form> </body> </html>Test See ‹/›
The numbers in the table indicate the first browser version that supports this attribute.
Attribute | |||||
---|---|---|---|---|---|
placeholder | 10.0 | 10.0 | 4.0 | 5.0 | 11.0 |
The placeholder specifies a brief hint describing the expected value of the input field (for example, a sample value or a brief description of the expected format).
A brief hint will be displayed in the input field before the user enters a value.
Note:The placeholder attribute is applicable to the following input types: text, search, url, tel, email, and password.
The placeholder attribute is an HTML5 The newly added attribute in.
<input placeholder="text">
Value | Description |
---|---|
text | Specify a short hint for the expected value of the input field description. |