Tutorials

KodeKite Tools

HTML
Flexbox
SVG
Canvas
HTML Tutorial

More


HTML Label
Label

Label element is used to create or attach labels, it is used for label the input fields in form or any other element and it is considered as point element or indication element.

Syntax

<form>
<label>Label name<label>any input field
</form>


You can use label any where within an HTML document.


Example


Note:

Label output is bold text and you can use <br /> element to separate inputs on new line.


Label is pair tag and output of label is bold text like you can see in above example.


Practice Task

Open notepad or any other text editor, follow the following points.


  • Create a form
  • add two input fields into form
  • one input field should be type=text
  • second input field should be type=password
  • Use label element to assign input fields names
  • Now add submit button of type=submit
  • Use <br /> to separate input fields on new line

save file with name task.html or task.htm and then open it using any browser and see results.


Solution




Don't forget label is non empty element which means it always comes in pair.