Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

How to specify a short hint that describes the expected value of an input element using HTML ?

  • Last Updated : 25 Dec, 2020

The placeholder attribute specifies a short hint for input field that describes the expected value of an input field/text area. The short hint is displayed in the field before the user enters a value.

Syntax:

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.

<element palceholder="value">

Attribute Value: This attribute describes the short hint in the input field.

Example:



HTML




<!DOCTYPE html>
<html>
  
<head>
    <title>
        How to specify a short hint
        that describes the expected
        value of an input element?
    </title>
</head>
  
<body style="text-align: center;">
    <h1 style="color: green;">
        GeeksforGeeks
    </h1>
  
    <h3>
        How to specify a short hint that
        describes <br>the expected
        value of an input element?
    </h3>
  
    <form action=" ">
        <input type="text" name="fname" 
            placeholder="First name">
        <br><br>
  
        <input type="text" name="lname" 
            placeholder="Last name">
        <br><br>
  
        <input type="submit" value="Submit">
    </form>
</body>
  
</html>

Output:

Supported Browsers: The browser supported by placeholder Attribute are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari



My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!