bestwebdesign

Freelancign web design and Graphics design

Thursday 23 November 2017

Form Elements

HTML Form Elements


The <input> Element


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

The <input> element can be shown in a few routes, contingent upon the sort attribute.

The <select> Element

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

Example

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

This is how the HTML code above will be displayed in a browser:



Visible Values:

Use the size attribute to specify the number of visible values:

Example

<select name="cars" size="3">
  <option value="volvo">Volvo</option>
  <option value="saab">Saab</option>
  <option value="fiat">Fiat</option>
  <option value="audi">Audi</option>
</select>
Try it Yourself »

This is how the HTML code above will be displayed in a browser:






Allow Multiple Selections:

Use the multiple attribute to allow the user to select more than one value:

Example

<select name="cars" size="4" multiple>
  <option value="volvo">Volvo</option>
  <option value="saab">Saab</option>
  <option value="fiat">Fiat</option>
  <option value="audi">Audi</option>
</select>
Try it Yourself »

This is how the HTML code above will be displayed in a browser:





The <textarea> Element

The <textarea> element defines a multi-line input field (a text area):

Example

<textarea name="message" rows="10" cols="30">
The cat was playing in the garden.
</textarea>
Try it Yourself »

This is how the HTML code above will be displayed in a browser:



You can also define the size of the text area by using CSS:

Example

<textarea name="message" style="width:200px; height:600px">
The cat was playing in the garden.
</textarea>
Try it Yourself »

This is how the HTML code above will be displayed in a browser:






The <button> Element

The <button> element defines a clickable button:

Example

<button type="button" onclick="alert('Hello World!')">Click Me!</button>
Try it Yourself »

This is how the HTML code above will be displayed in a browser:

 



HTML5 <datalist> Element

The <datalist> element indicates a rundown of pre-characterized choices for a <input> element. 

Clients will see a drop-down rundown of the pre-characterized choices as they input data. 


The rundown attribute of the <input> element, must allude to the id attribute of the <datalist> element.


Example

<form action="/action_page.php">
  <input list="browsers">
  <datalist id="browsers">
    <option value="Internet Explorer">
    <option value="Firefox">
    <option value="Chrome">
    <option value="Opera">
    <option value="Safari">
  </datalist>
</form>
Try it Yourself »

This is how the HTML code above will be displayed in a browser:



HTML5 <output> Element

The <output> element speaks to the aftereffect of an estimation (like one performed by a content).

Example

<form action="/action_page.php"
  oninput="x.value=parseInt(a.value)+parseInt(b.value)"
>

  0
  <input type="range"  id="a" name="a" value="50">
  100 +
  <input type="number" id="b" name="b" value="50">
  =
  <output name="x" for="a b"></output>
  <br><br>
  <input type="submit">
</form>
Try it Yourself »

This is how the HTML code above will be displayed in a browser:

0 100 + =

Share:

0 comments:

Post a Comment


Web Design Tutorial

Theme Support

Munere veritus fierent cu sed, congue altera mea te, ex clita eripuit evertitur duo. Legendos tractatos honestatis ad mel. Legendos tractatos honestatis ad mel. , click here →