The <input> Element

The most important form element is the <input> element.

The <input> element can be displayed in several ways, depending on the type attribute.


<input name="firstname" type="text">


The <select> Element

The <select> element defines a drop-down list:


<select name="cars">
  <option value="volvo">Volvo</option>
  <option value="saab">Saab</option>
  <option value="fiat">Fiat</option>
  <option value="audi">Audi</option>


The <option> elements defines an option that can be selected.

By default, the first item in the drop-down list is selected.

To define a pre-selected option, add the selected attribute to the option:


<option value="fiat" selected>Fiat</option>

Leave a Reply

Your email address will not be published. Required fields are marked *