Professional Documents
Culture Documents
HTML5 Form Controls Continued
HTML5 Form Controls Continued
<figcaption>
• The purpose of a <figcaption> is to add a visual explanation to an image.
• With HTML5, images and captions can be grouped together in <figure>
elements.
<figure>
<img src="html5.png" alt="HTML5" width="200" height="350" />
<figcaption>HTML5 - The Latest Version of HTML</figcaption>
</figure>
HTML5 <main>
Element
• The <main> tag specifies the main content of a document.
• The content inside the <main> element should be unique to the
document. It should not contain any content that is repeated across
documents such as sidebars, navigation links, copyright information, site
logos, and search forms.
• There must not be more than one <main> element in a document.
• The <main> element must NOT be a descendant of an <article>,
<aside>,
<footer>, <header>, or <nav> element.
HTML5 <main>
Element
<body>
<header>
<h1>Website Heading</h1>
</header>
<main>
...
</main>
<footer>
<p>© HTML5 Developers.</p>
</footer>
</body>
HTML5 <mark>
Element
• The <mark> tag defines marked text.
• Use the <mark> tag if you want to highlight parts of your text.
<article>
<h1>HTML5</h1>
<p>HTML5 is used for <mark>structuring</mark> and presenting
content for the World Wide Web</p>
</article>
HTML5 FORM CONTROLS
HTML5 Form
Elements
• HTML5 added the following form elements:
– <datalist>
– (Already Covered in Previous Lecture)
HTML5 <datalist>
Element
• The <datalist> element specifies a list of pre‐defined options for an <input>.
• Users will see a drop‐down list of pre‐defined options as they input data.
• The list attribute of the <input> element, must refer to the id attribute of the
<datalist> element.
<form action="">
<input type="text" list="browsers" />
<datalist id="browsers">
<option value="Internet Explorer">
<option value="Firefox">
<option value="Chrome">
<option value="Safari">
</datalist>
</form>
• date • color
• month • number
• week • range
• time • email
• datetime‐local • search
• tel
• url
Input Type:
number
• The <input type="number"> is used for input fields that should contain a
numeric value.
• You can set restrictions on the numbers.
• Depending on browser support, the restrictions can apply to the input
field.
<form action="">
Quantity (between 1 and 5):
<form action="">
Select your favorite color:
<input type="color" name="favcolor" value="#ff0000" />
<input type="submit" />
</form>
• autocomplete • list
• autofocus • min and max
• form • multiple
• formaction • pattern (regexp)
• formenctype • placeholder
• formmethod • required
• formnovalidate • step
• formtarget
• height and width
<form action="">
<input type="text" name="fn" placeholder="First name" /><br />
<input type="text" name="ln" placeholder="Last name" /><br />
<input type="submit" value="Submit" />
</form>
<form action="">
Username: <input type="text" name="usrname" required />
<input type="submit" />
</form>
• Before HTML5, videos could only be played with a plug‐in (like flash).
Safari YES NO NO
• Before HTML5, audio files could only be played with a plug‐in (like
flash).
<source src="sound.mp3" type="audio/mpeg" /> Your browser does not support the audio
element.
</audio>