HTML placeholder Attribute


The HTML placeholder attribute represents the text that is displayed in the input/textarea element before the user begin entering anything.

Syntax

Following is the syntax −

<tagname placeholder=”text”></tagname>

Let us see an example of HTML placeholder Attribute −

Example

Live Demo

<!DOCTYPE html>
<html>
<style>
   body {
      color: #000;
      height: 100vh;
      background-color: #8BC6EC;
      background-image: linear-gradient(135deg, #8BC6EC 0%, #9599E2 100%);
      text-align: center;
   }
</style>
<body>
<h1>HTML placeholder Demo</h1>
<input type="text" placeholder='Enter your first name'>
<input type="text" placeholder='Enter your last name'>
</body>
</html>

Output

Updated on: 17-Feb-2021

144 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements