Placehodel: Place data (according to the dictionary).
The placeholder property specifies a short hint describing the expected value of the input field (for example, a sample value or a short description of the expected format).
A short hint is displayed in the input field before the user enters a value.
1. Placeholder uses
Step 1: Add the placeholder attribute on the input . tag
Syntax:
1 2 | <input placeholder="value"> |
Attribute value:
Value | Describe |
---|---|
Text | Specify a short hint describing the expected value of the input field |
Step 2: Add on CSS
1 2 3 4 | ::placeholder { css declarations; } |
2 . Difference between placeholder and data-placeholder
- The placeholder attribute is a standard HTML5 attribute
- data-placeholder is just data- HTML5 attribute used by some javascript plugins. Data is the generic data attached to the element.
Try the example below to see the difference: