input placeholder - HTML CSS HTML Tag

HTML CSS examples for HTML Tag:input

Introduction

You can use the value attribute to specify a default value and the placeholder attribute to give the user a helpful hint.

The following code shows how to use the value and placeholder Attributes.

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
   <head> 
      <title>Example</title> 
   </head> 
   <body> 
      <form method="post" action="http://example.com/form"> 
         <p> 
            <label for="name">
                Name: <!--from   w  w w .j  av  a 2s.c o m-->
               <input placeholder="Your name" id="name" name="name"> 
            </label> 
         </p> 
         <p> 
            <label for="city">
                City: 
               <input placeholder="Where you live" id="city" name="city"> 
            </label> 
         </p> 
         <p> 
            <label for="fave">
                Fruit: 
               <input value="Apple" id="fave" name="fave"> 
            </label> 
         </p> 
         <button type="submit">Submit Vote</button> 
      </form>  
   </body>
</html>

Related Tutorials