input autofocus - HTML CSS HTML Tag

HTML CSS examples for HTML Tag:input

Introduction

You can select which input element the browser focuses on when the form is displayed.

You specify which input element the focus should be applied to with the autofocus attribute.

Using the autofocus Attribute

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="fave">
               Fruit: <!--from ww w.  jav a2 s. c o m-->
               <input autofocus id="fave" name="fave">
            </label> 
         </p> 
         <p>
            <label for="name">
               Name: 
               <input id="name" name="name">
            </label>
         </p> 
         <button>Submit Vote</button> 
      </form>  
   </body>
</html>

Related Tutorials