UNIT-1 (1)
UNIT-1 (1)
► HTML stands for Hyper Text Markup Language. It is used to design web pages using a markup language.
The markup language is used to define the text document within the tag which defines the structure of web
pages. HTML 5 is the fifth and current version of HTML.
Advantages:
► All browsers supported.
► More device friendly.
► Easy to use and implement.
► HTML 5 is integration with CSS, JavaScript, etc. can help build beautiful websites.
Disadvantages:
► Long codes have to be written which is time consuming.
► Only modern browsers support it.
New features of HTML5
HTML5 introduced several new features and improvements over its predecessors, making
web development more efficient, interactive, and user-friendly. Here are some key features:
4. Form Enhancements
● Web Storage (localStorage & sessionStorage) - Stores data on the client side.
● Geolocation API - Gets the user's geographical location.
● Drag & Drop API - Enables drag-and-drop functionality.
● WebSockets API - Enables real-time communication between client and server.
● History API - Manages browser history without page reloads
.
6. Offline & Performance Features
1. Better Structure – Provides a clear and organized way to structure web pages.
2. Responsive Design – Works well on different screen sizes, including mobile devices.
3. Multimedia Support – Supports audio and video without extra plugins like Flash.
4. Semantic Elements – Improves readability with tags like <article>, <header>, and <footer>.
5. Improved Forms – Offers new input types like <email> and <date> for better user experience.
6. Offline Browsing – Allows web apps to work offline using the cache feature.
7. Better Performance – Reduces the need for external scripts, making websites faster.
8. Geolocation API – Helps in tracking user location for maps and navigation.
9. Canvas & SVG – Enables drawing graphics and animations without extra software.
10. Cross-Browser Compatibility – Works smoothly on modern web browsers.
New Elements in HTML5
In HTML5, there are lots of new elements are added which provides some extra
functionality to create an attractive and dynamic website. With the help of these elements,
you can make your code easy and quick.
1. Structural (Semantic) Elements
Tag Description
<header> Defines the header of a webpage or section.
<nav>. Contains navigation links.
<section> Groups related content together.
Represents standalone content (e.g., blog post,
<article>
news).
<aside> Defines side content (e.g., sidebars).
<footer> Defines the footer of a webpage or section.
<main> Specifies the main content of a webpage.
<figure> Groups media elements like images or diagrams.
<figcaption> Provides captions for <figure>.
<mark> Highlights important text.
<time> Represents a specific time or date.
<summary> Provides a summary for <details>.
<details> Creates a collapsible section of content.
2. Multimedia Elements
Tag Description
<audio> Embeds an audio file.
<video> Embeds a video file.
Provides multiple sources for
<source>
<audio> and <video>.
<track> Adds captions/subtitles to <video>.
3. Graphics and Media Elements
► These elements allow drawing graphics, animations, and scalable
images directly in HTML.
Tag Description
Tag Description
<details> Creates a collapsible content section.
<summary> Provides a heading for <details>.
The HTML <form> element can contain one or more of the following
form elements:
● <input>
● <label>
● <select>
● <textarea>
● <button>
● <fieldset>
● <legend>
● <datalist>
● <output>
● <option>
● <optgroup>
The <input> Element
The <input> element can be displayed in several ways, depending on the type
attribute.
Example
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname">
The <label> Element
The <label> element is useful for screen-reader users, because the screen-
reader will read out loud the label when the user focus on the input
element.
The <label> element also help users who have difficulty clicking on very
small regions (such as radio buttons or checkboxes) - because when the
user clicks the text within the <label> element, it toggles the radio
button/checkbox.
The for attribute of the <label> tag should be equal to the id attribute of the
<input> element to bind them together.
The <select> Element
Example
The rows attribute specifies the visible number of lines in a text area.
Click Me!
The <fieldset> and <legend> Elements
The <fieldset> element is used to group related data in a form.
The <legend> element defines a caption for the <fieldset> element.
Example
<form action="/action_page.php">
<fieldset>
<legend>Personalia:</legend>
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname" value="John"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname" value="Doe"><br><br>
<input type="submit" value="Submit">
</fieldset>
</form>
The <datalist> Element
Users will see a drop-down list of the pre-defined options as they input
data.
The list attribute of the <input> element, must refer to the id attribute of
the <datalist> element.
Example
<form action="/action_page.php">
<input list="browsers">
<datalist id="browsers">
<option value="Edge">
<option value="Firefox">
<option value="Chrome">
<option value="Opera">
<option value="Safari">
</datalist>
</form>
The <output> Element
The <output> element represents the result of a calculation (like one
performed by a script).
Example
Perform a calculation and show the result in an <output> element:
<form action="/action_page.php"
oninput="x.value=parseInt(a.value)+parseInt(b.value)">
100 +
<br><br>
<input type="submit">
</form>
HTML 5 form attributes
Usually, the form data is sent to a file on the server when the user clicks on
the submit button.
The target attribute specifies where to display the response that is received
after submitting the form.
Value Description
Notes on POST:
● Appends the form data inside the body of the HTTP request (the
submitted form data is not shown in the URL)
● POST has no size limitations, and can be used to send large amounts of
data.
● Form submissions with POST cannot be bookmarked
Tip: Always use POST if the form data contains sensitive or personal
information!
The Autocomplete Attribute
Example
Example
A form with a novalidate attribute:
<form action="/action_page.php" novalidate>
The Method Attribute
Example
This example uses the GET method when submitting the form data:
<form action="/action_page.php" method="get">
Example
This example uses the POST method when submitting the form data:
<form action="/action_page.php" method="post">