4.docxform by Anisul Islam
4.docxform by Anisul Islam
4.docxform by Anisul Islam
4 HTML Form
<form> element is used to create a html form. form help us to collect user data.
<label> element is used for labelling form elements. It helps the form elements accessible by guiding the screen
reader. <label for="name"> element has for="" attribute which value should be equal to <input id="name"/>
element's id value.
<fieldset>
<legend>
<output>
form attributes:
<input type="range" min="" max=""/> creates a range by setting min and max value, default range is 0 to 100.
Input attributes:
size="" attribute is used to set the number of characters for an input field.
maxlength="" attribute is used to set the maximum number of characters for an input field.
max="" attribute is used to set the maximum input value for an input field.
min="" attribute is used to set the minimum input value for an input field.
pattern="" attribute is used to set a regular expression for validating an input field.
placeholder="" attribute is used to give a hint to the users.
required attribute specifies that an input element must be filled before submitting the form.
autofocus attribute makes an input field automatically focus when the page is loaded.
height="" width="" attribute is used to set input elements height and width.
<div>
<datalist id="usernames">
<option value="anis"></option>
<option value="linkon"></option>
<option value="ridoy"></option>
</datalist>
<input
type="text"
id="username"
name="username"
size="30"
autofocus
required
list="usernames"
/>
</div>
<br />
<div>
</div>
<br />
<div>
</div>
<br />
<div>
</div>
<br />
<div>
</div>
<br />
<div>
</div>
<br />
<div>
<input
type="number"
id="random"
name="random"
min="1"
max="5"
value="3"
/>
</div>
<br />
<div>
</div>
<br />
<div>
</div>
<br />
<div>
</div>
<br />
<div>
</div>
<br />
<div>
<p>Religion:</p>
<div>
<label for="muslim">muslim</label>
</div>
<div>
</div>
<div>
<label for="other">other</label>
</div>
</div>
<br />
<div>
<p>Gender:</p>
<div>
<label for="male">male</label>
</div>
<div>
<label for="female">female</label>
</div>
<div>
<label for="other">other</label>
</div>
</div>
<br />
<div>
<option value="cse">CSE</option>
<option value="eee">EEE</option>
<option value="llb">LLB</option>
</select>
</div>
<!-- textarea -->
<br />
<div>
</div>
<br />
<div>
<button type="reset">Clear</button>
</div>
</form>
HTML5'S Objectives
improve accessibility