Lecture-3---HTML-III-
Lecture-3---HTML-III-
Lecture 03
(HTML5 - III)
1
Block and Inline elements
• Block elements contain an entire large region of
content.
• Examples:
paragraphs, lists, table cells, div, section,
header, footer, ul etc.
• <ol>
<li> One </li>
<li> Two </li>
<li> Three </li>
</ol>
Type Attribute of Ordered List
• HTML provide several tags for displaying list.
• <ol type=“a”>
<li> One </li>
<li> Two </li>
<li> Three </li>
</ol>
• Example
<ul>
<li> Four </li>
<li> Five </li>
<li> Six </li>
</ul>
Type Attribute of Unordered List
• <ul>
<li> Four </li>
<li> Five </li>
<ul>
<li> Four </li>
<li> Five </li>
<li> Six </li>
</ul>
<li> Six </li>
</ul>
Nested Ordered List
• Example
• <ol>
<li> One </li>
<li> Two </li>
<ol>
<li> One </li>
<li> Two </li>
<li> Three </li>
</ol>
<li> Three </li>
</ol>
Nested Unordered & Ordered List
• Example
• <ol>
<li> One </li>
<li> Two </li>
<ul>
<li> One </li>
<li> Two </li>
<li> Three </li>
</ul>
<li> Three </li>
</ol>
EXAMPLE
• <ol>
<li> One </li>
<li> Two </li>
<ol start=“5”>
<li> One </li>
<li> Two </li>
<ol type=“i” start=“7”>
<li> One </li>
<li> Two </li>
<li> Three </li>
</ol>
<li> Three </li>
</ol>
<li> Three </li>
</ol>
12
Images with List
Try it yourself!
How to use images with list items
Images
• Images are major part of websites.
Example:
<body>
<h1> HTML Image </h1>
<img src="images/BULC.png"
width="240" height="240" alt="Logo of BULC"
title="BU Lahore Official Logo" />
</body>
14
Link on a Image
<body>
<a href="https://www.bahria.edu.pk/bulc/"
target="_blank">
<img src="images/BULC.png" width="240"
height="240" alt="Logo of BULC" title="BU
Lahore Official Logo" />
</a>
</body>
15
FLOWING TEXT AROUND AN IMAGE
• HTML IMG tag is inline element. Sometimes we
want to flow text around an image.
• Example:
<body>
<h1> HTML Image </h1>
<img src="images/BULC.png" width="240"
height="240" alt="Logo of BULC" title="BU Lahore
Official Logo" style="float: right; margin-right: 10px;
margin-bottom: 5px; border: solid black 1px;"/>
</body>
16
Embedding Audio
• HTML5 provides the simple powerful feature of adding
audio files on your web page.
• Example:
<p> Here’s a song: </p>
<audio id=“audio” controls autoplay loop>
<source
src=“media/song.mp3”
type=“audio/mpeg” />
<source
src=“media/song.ogg”
type=“audio/ogg” />
</audio>
17
Embedding Video
• HTML5 provides the simple powerful feature of embedding
video files on your web page.
• Example:
<p> Here’s a song: </p>
<video id=“video” width=“860” height=“480” controls autoplay
loop>
<source
src=“media/video.m4v” type=“video/mp4” />
<source
src=“media/video.webm” type=“video/webm” />
<source
src=“media/video.ogg” type=“video/ogg” />
</video>
18
Table
<TABLE>
(made up of rows)
Row
<TR>
(made up of data cells)
Heading Data Cell
<TH> (Can contain paragraphs,
images, lists, forms, tables)
Data Cell
<TD> (Can contain paragraphs,
images, lists, forms, tables)
19
Tables
• Tables are very useful feature in HTML.
• Example:
<h1>HTML Tables</h1>
<table>
<caption>My Favorite Albums</caption>
<tr>
<th> Title </th>
<th> Artist </th>
<th> Comment </th>
</tr>
<tr>
<td> Electric Lady Land </td>
<td> Jimi Hendrix </td>
<td> Revolutionary </td>
</tr>
</table>
20
SEMENTICS PART OF TABLE
• HTML5 provides few semantic elements just for tables.
• <table>
<caption></caption>
<thead>
<tr>
<th> Title </th>
<th> Artist </th>
<th> Comments </th>
</tr>
</thead>
<tfoot>
<tr>
….
</tr>
</tfoot>
21
TABLE Attributes
• CELLPADDING
– Determines the distance between the border of a cell and
the contents of the cell
– Example: <TABLE CELLPADDING = “3”>
• CELLSPACING
– Determines the empty spacing between the borders of
two adjacent cells
– Example: <TABLE CELLSPACING = “1”>
22
<TH> & <TD> Attributes
• COLSPAN
– No. of rows the current cell should extend itself downward
– Example: <TD COLSPAN = “2”>
• ROWSPAN
– The number of columns the current cell should extend
itself
– Example: <TD ROWSPAN = “5”>
23
Expenses Income
Quarte
Year Quetta Dubai Quetta Dubai
r