English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Referenzhandbuch

Vollständiges Verzeichnis der HTML-Tags

HTML: <input> placeholder-Eigenschaft

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.

 HTML <input> Tag

Beispiel 1

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.

Online-Beispiel 2

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 ‹/›

Browser Compatibility

The numbers in the table indicate the first browser version that supports this attribute.

Attribute




placeholder10.010.04.05.011.0

Definition and Usage

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.

HTML 4.01 with HTML5differences

The placeholder attribute is an HTML5 The newly added attribute in.

Syntax

<input placeholder="text">

Attribute Value

ValueDescription
textSpecify a short hint for the expected value of the input field description.
 HTML <input> Tag