HTML 5
HTML 5
Elements syntax
• Elements doesn't show on a web pages, only content will be
display.
Web Browsers
• The purpose of web browser like Chrome, Edge, Firefox,
Opera, Safari, etc. is to read HTML document and display
them correctly.
• Browser read element – tag and show their content on a
web pages.
• Browser does not show element – tag name only show his
content.
• A browser does not display the HTML tags, but uses them
to determine how to display the document.
HTML Page Structure
<!DOCTYPE html>
</html>
HTML Documents
• All HTML Documents must start with a document type
declaration.
• <!DOCTYPE html> - defines that this is an HTML5
document.
• The HTML document itself begins with <html> and ends
with </html>.
• <head> element contains meta information about the HTML
pages.
• <title> define title for the HTML page, which is shown in the
browser’s title bar (tab).
• The visible part of the HTML document is between <body>
tag </body>.
Headings
• HTML headings are titles or subtitles that you want to
display on a webpage.
• HTML headings are defined with the <h1> to <h6> tags.
• Example:-
<p> This is paragraph first line <br>
this is paragraph second line. </p>
</pre>
Pre tag example
<pre>
Twinkle, twinkle, little star,
• <b> tag & <strong> tag are same working but purpose are
different.
Italic Tag
• Syntax:- <i> tag.
• The <i> tag is often used to indicate a technical term, a
phrase from another language, a thought, a ship name, etc.
• Example:-
<p> <i> This is my pen. </i> </p>
<p> I'm going to buy a new
<i>Laptop.</i> </p>
Emphasized tag
• Syntax:- <em> tag.
• The HTML <em> element defines emphasized text. The
content inside is typically displayed in italic.
• A screen reader will pronounce the words in <em> with an
emphasis, using verbal stress.
• Example:-
<p> This is my pen. </p>
<p> This is my
<em> parker company pen. </em> </p>
Mark Tag
• Syntax:- <mark> tag.
• The HTML <mark> element defines text that should be
marked or highlighted.
• Example:-
<p> Do not forget to buy a notebook when you go to
the market. </p>
Example:-
<Img src=“nature.png”/>
• src attribute specifies the path of image which load on a
web page.
Image Tag
• Syntax:- <img />
• HTML images are defined with the <img> tag.
• Images can improve the design and the appearance of a
web page.
• Images are not technically inserted into a web page, images
are linked to web page.
• The <img /> tag creates a holding space for the referenced
images.
• The <img /> tag is empty, it contains attributes only, and
does not have a closing tag.
Image Tags Attributes
• The <img /> tag has many attributes.
• Example:-
<img src=“/image/logo.png”
alt=“coding seekho logo”/>
• Example:-
<a href=“home.html”>
<img src=“logo.png" alt=“logo”
width=“100px” height=“70px”/>
</a>
Link to an Email Address
• You can create a link for receiving mail from user who
visited at your web pages by creating mail link.
• Use mailto: inside the href attribute to create a link that
opens the user's email program (to let them send a new
email).
•
• Example:-
<a href="mailto:[email protected]">
Send email</a>
Address Tag
• The HTML <address> tag defines the contact information
for the author/owner of a document or an article.
• The contact information can be an email address, URL,
physical address, phone number, social media handle, etc.
• The text in the <address> element usually renders in italic.
• Example:-
<address>
Coding Seekho,<br>
college road, nashik.
</address>
<cite> Tag for Work Title
• The HTML <cite> tag defines the title of a creative work
(e.g. a book, a poem, a song, a movie, a painting, etc.).
• A person's name is not the title of a work.
• The text in the <cite> element usually renders in italic.
• Example:-
<p> <cite> HTML </cite>
Invented by Tim Berners – Lee </p>
Bi-Directional Override
• BDO stands for Bi-Directional Override.
• The HTML <bdo> tag is used to override the current text
direction.
• <bdo> tag has “dir” attribute it means direction.
• “dir” has to value –
1. “ltr” – left to right.
2. “rtl” – right to left.
Example:-
<bdo dir="rtl">
This text will be written from right to left</bdo>
Abbreviation Tag
• Syntax:- <abbr>
• The HTML <abbr> tag defines an abbreviation or an
acronym, like “HTML”, “CSS”, “VSPI”, “CS” etc.
• Marking abbreviation can give useful information to
browser and search engines.
• Example:-
• <p> The
<abbr title=“VS Programming Institute”>VSPI</abbr>
was found in 2017 </p>
Details Tag
• Syntax:- <details>
<summary> <p> HTML </p> </summary>
</details>
• The <details> tag specifies additional details that the user
can open and close on demand.
• The <details> tag is used to create an interactive Q&A that
user can open and close.
• By default the tag is closed (Q). When open, it expands,
and display the content within (A).
• The <summary> tag is used in conjunction with <details>
to specify a visible for the details.
Table Tag
• Syntax:- <table> …… </table>
• Table tag allow web developers to arrange data into rows
and columns.
• Table tag consists of table cells inside rows and columns.
• You can create table using
<table>
</table>
Table Row
• Syntax:- <tr> ….. </tr> - Table row
• Each table data filling in row format, every new line data
filled in row format.
• Each table row starts with a
<tr> …. End with a…. </tr>
<table>
<tr>
</tr>
</table>
Table Data
• Each table data is defined by a <td> ….. </td>
• <td> stands for Table Data.
• Everything between <td> …. </td> are the content of the table
cell.
• A table cell can contain all sorts of HTML tags like - text,
images, lists, etc.
• Example:-
<table>
<tr>
<td> Coding Seekho </td>
</tr>
</table>
Table Header
• Syntax:- <th> …. </th> - Table Header/Heading.
• Sometimes you want your cells to be table header cells. In those
cases use the <th> tag instead of the <td> tag.
• First row will be your table header row.
• By default the table text in <th> tag are bold and centered.
• To use the first column as table headers, define the first cell in
each row as a <th> tag.
• Example:- <table>
<tr>
<th>…Content…</th>
</tr>
</table>
Table Attributes
• Syntax:- <table border=“1px”>
• The tables can have borders of different style and shapes.
• When you add a border to a table, you also add border
around each table cell.
• Example:-
<table border=“1px”>
<tr>
<td>…content…</td>
</tr>
</table>
Table Size
• Syntax:- <table width=“500px”>
<table height=“300px”>
• Table can have different sizes for each column, row or the
entire table.
• To set the width and height of a table, add the attributes in
table tag.
• To set the size of specific columns or rows add the height
and row attributes in <th> or <td>.
• Example:-
<td width=“200px” height=“100px”>
<th width=“200px” height=“100px”>
Table Caption
• Syntax:- <caption> … </caption>
• You can add a caption that servers as a heading for the
entire table.
• To add a caption for a table, use the <caption> tag.
• The <caption> tag should be inserted immediately after the
<table> tag.
• Example:-
<table>
<caption> …content…</caption>
</table>
Table Cell Padding
• Syntax:- <table cellpadding=“10px”>
• Table can adjust the padding inside the cells.
• Cell padding is the space between the cell edges and the
cell content.
• By default the padding is set to zero.
• Example:-
<table cellpadding=“50px”>
<tr>
<td> Coding Seekho </td>
</tr>
</table>
Table Cell Spacing
• Syntax:- <table cellspacing=“5px”>
• Cell spacing is the space between each cell.
• By default the space is set to 2pixels.
• To change the space between table border cells use cell
spacing.
• Example:-
<table cellspacing=“5px”>
<tr>
<td> coding seekho </td>
</tr>
</table>
Table Colspan
• Syntax:- <td colspan=“2”>
• The table can have cells that span over multiple rows and columns.
• To make a cell span over multiple columns, use the colspan
attributes.
• The value of the colspan attribute represent the number of
columns to span.
• Example:-
<table>
<tr>
<td colspan=“2”> coding seekho </td>
</tr>
</table>
Table Rowspan
• Syntax:- <td rowspan=“2”>
• The table can have cells that span over multiple rows and columns.
• To make a cell span over multiple rows, use the rowspan attributes.
• The value of the rowspan attribute represent the number of rows to
span.
• Example:-
<table>
<tr>
<td rowspan=“2”> coding seekho </td>
</tr>
</table>
List Tag
• HTML lists allow web developers to group a set of related
items in lists.
• List tag (li)
• There are three types in list –
1. Unordered List (ul) - disc,square,circle,none
• HTML
• CSS
• JAVASCRIPT
2. Ordered List (ol) - 1,A,a,I,i
1. HTML
2. CSS
3. JAVASCRIPT
• Example:-
• <ol start="50">
<li>HTML</li>
<li>CSS</li>
<li>JS</li>
</ol>
Nested List
• Lists can be nested (list inside list). Unordered type.
• Example:-
• <ul>
<li>Samsung</li>
<li>Iphone
<ul>
<li>Iphone 10</li>
<li>Iphone 11</li>
</ul>
</li>
<li>Oppo</li>
</ul>
Nested List
• Lists can be nested (list inside list). Ordered type.
• Example:-
• <ol>
<li>LG TV</li>
<li>Samsung
<ol>
<li>Touch Screen</li>
<li>Regular Screen</li>
</ol>
</li>
<li>BPL</li>
</ol>
Description Lists
• A description list is a list of terms, with a description of each
term.
• The <dl> tag defines the description list
• The <dt> tag defines the term (name)
• The <dd> tag describes each term:
• Example:-
• <dl>
<dt>HTML</dt>
<dd>- HyperText Markup Language</dd>
<dt>CSS</dt>
<dd>- Cascading Style Sheet</dd>
</dl>
Iframe Tag
• An HTML iframe is used to display a web page within a
web page.
• The HTML <iframe> tag specifies an inline frame.
• An inline frame is used to embed another document within
the current HTML document.
• Syntax
• <iframe src="url" title="description"></iframe>
• Use the height and width attributes to specify the size of
the iframe.
• The height and width are specified in pixels by default.
HTML Multimedia
• Multimedia on the web is sound, music, videos, movies,
and animations.
• What is Multimedia?
• Multimedia comes in many different formats. It can be
almost anything you can hear or see, like images, music,
sound, videos, records, films, animations, and more.
• Web pages often contain multimedia elements of different
types and formats.
HTML Multimedia
• Browser Support
• The first web browsers had support for text only, limited to a
single font in a single color.
• Later came browsers with support for colors, fonts, images,
and multimedia!
• Multimedia Formats
• Multimedia elements (like audio or video) are stored in
media files.
• The most common way to discover the type of a file, is to
look at the file extension.
• Multimedia files have formats and different extensions
like: .wav, .mp3, .mp4, .mpg, .wmv, and .avi.
Video Tag
• The HTML <video> element is used to show a video on a
web page.
• To show a video in HTML, use the <video> tag.
• In <video> tag you can use – source
example:-
<video>
<source src=“ulr” type=“video/mp4”>
Source tag for providing video path.
</video>
Video Tag Attributes
• The <source> element allows you to specify alternative
video files which the browser may choose from. The
browser will use the first recognized format.
• Example:-
<marquee>
This is an example of html marquee </marquee>
Marquee Attributes
• Marquee's element contains several attributes that are
used to control and adjust the appearance of the marquee.
• Using form tag you can create many types of form like login
form, payment gateway form, data collection form, etc.
The <input> tag
• Syntax:- <input>
• <form>
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname">
</form>
Input Type Password
• <input type="password"> defines a password field.
• Example:-
• The characters in a password field are masked (shown as
asterisks or circles).
<form>
<label for="username">Username:</label><br>
<input type="text" id="username" name="username"><br
>
<label for="pwd">Password:</label><br>
<input type="password" id="pwd" name="pwd">
</form>
Input Type Submit
• <input type="submit"> defines a button for submitting form data to
a form-handler.
• The form-handler is typically a server page with a script for
processing input data.
• The form-handler is specified in the form's action attribute:
<form action="/action_page.php">
<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">
</form>
Input Type Reset
• <input type="reset"> defines a reset button that will reset
all form values to their default values.
<form>
<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="reset">
</form>
Input Type Radio
• input type="radio"> defines a radio button.
• Radio buttons let a user select ONLY ONE of a limited number of
choices.
• Example:-
• <p>Choose your favourite Web language:</p>
<form>
<input type="radio" id="html" name="fav_language"
value="HTML">
<label for="html">HTML</label><br>
<input type="radio" id="css" name="fav_language“
value="CSS">
<label for="css">CSS</label><br>
</form>
Input Type Checkbox
• <input type="checkbox"> defines a checkbox.
• Checkboxes let a user select ZERO or MORE options of a
limited number of choices.
<form>
<input type="checkbox" id="vehicle1" name="vehicl
e1" value="Bike">
<label for="vehicle1"> I have a bike</label><br>
<input type="checkbox" id="vehicle2" name="vehicl
e2" value="Car">
<label for="vehicle2"> I have a car</label><br>
</form>
Input Type Color
• The <input type="color"> is used for input fields that
should contain a color.
• Depending on browser support, a color picker can show up
in the input field.
• Example:-
<form>
<label for="favcolor">Select your favorite
color:</label>
<input type="color" id="favcolor" name="favcolor">
</form>
Input Type Date
• The <input type="date"> is used for input fields that should
contain a date.
• Depending on browser support, a date picker can show up in
the input field.
• Example:-
<form>
<label for="birthday">Birthday:</label>
<input type="date" id="birthday" name="birthday">
</form>
Min & Max In Date
• You can also use the min and max attributes to add restrictions to
dates.
• Example:-
<form>
<label for="datemax">Enter a date before
1980-01-01:</label>
<input type="date" id="datemax" name="datemax“
max="1979-12-31"><br><br>
<label for="datemin">Enter a date after
2000-01-01:</label>
<input type="date" id="datemin" name="datemin"
min="2000-01-02">
</form>
Input Type Datetime-local
• The <input type="datetime-local"> specifies a date and time
input field, with no time zone.
• Depending on browser support, a date picker can show up in
the input field.
• Example:-
<form>
<label for="birthdaytime">Birthday
(date and time):</label>
<input type="datetime- local"
id="birthdaytime" name="birthdaytime">
</form>
Input Type Button
• <input type="button"> defines a button.
• <input type="button"
onclick="alert('Hello World!')“
value="Click Me!">
• Example:-
• <form>
• <input type="image" src="img_submit.gif"
alt="Submit" width="48" height="48">
</form>
Input Type File
• The <input type="file"> defines a file-select field and a
"Browse" button for file uploads.
• Example:-
<form>
<label for="myfile">Select a file:</label>
<input type="file" id="myfile" name="myfile">
</form>
Input Type Month
• The <input type="month"> allows the user to select a
month and year.
• Depending on browser support, a date picker can show up
in the input field.
<form>
<label for="bdaymonth">Birthday
(month and year):</label>
<input type="month" id="bdaymonth"
name="bdaymonth">
</form>
Input Type Number
• The <input type="number"> defines a numeric input field.
• You can also set restrictions on what numbers are
accepted.
• The following example displays a numeric input field,
where you can enter a value from 1 to 5:
<form>
<label for="quantity">Quantity
(between 1 and 5):</label>
<input type="number" id="quantity"
name="quantity" min="1" max="5">
</form>
Input Type Range
• The <input type="range"> defines a control for entering a
number whose exact value is not important (like a slider
control). Default range is 0 to 100. However, you can set
restrictions on what numbers are accepted with
the min, max, and step attributes.
<form>
<label for="vol">Volume
(between 0 and 50):</label>
<input type="range" id="vol" name="vol"
min="0" max="50">
</form>
Input Type Search
• The <input type="search"> is used for search fields (a
search field behaves like a regular text field).
example:-
<form>
<label for="gsearch">Search Google:</label>
<input type="search" id="gsearch" name="gsearch">
</form>
Input Type Tel
• The <input type="tel"> is used for input fields that should
contain a telephone number.
• Example:-
<form>
<label for="phone">Enter your phone
number:</label>
<input type="tel" id="phone" name="phone">
</form>
Input Type Time
• The <input type="time"> allows the user to select a time
(no time zone).
• Depending on browser support, a time picker can show up
in the input field.
• Example:-
<form>
<label for="appt">Select a time:</label>
<input type="time" id="appt" name="appt">
</form>
Input Type Week
• The <input type="week"> allows the user to select a week
and year.
• Depending on browser support, a date picker can show up
in the input field.
• Example:-
<form>
<label for="week">Select a week:</label>
<input type="week" id="week" name="week">
</form>
Input Attributes
• The value Attribute
• The input value attribute specifies an initial value for an
input field.