Lecture 1 Html-Combined
Lecture 1 Html-Combined
HTML
Setup & HTML
By Muhammad Ismail
Setup ❏ Google Chrome
https://www.google.com/chro
me/?brand=FHFK&gclid=Cj0K
CQiApb2bBhDYARIsAChHC9u
kVt1vxMYW3AOUcwDCz38Lr
RDXKVpL9msOx05f6Ly4qse4
QGVEGxgaAjcHEALw_wcB&gc
lsrc=aw.ds
https://code.visualstudio.com/
HTML What is HTML?
HTML
HTML Text tags
By Muhammad Ismail
INTRODUCTION:
Basic HTML Tags
The most important tags in HTML are
tags that define headings, paragraphs
and line breaks. The best way to learn
HTML is to work with examples.
❏ Headings
❏ Paragraphs
❏ Line Breaks
❏ Comments in HTML
By Muhammad Ismail
Headings are defined with the <h1> to <h6>
Headings tags. <h1> defines the largest heading. <h6>
defines the smallest heading.
<h1>This is a heading</h1>
<h2>This is a heading</h2>
<h3>This is a heading</h3>
<h4>This is a heading</h4>
<h5>This is a heading</h5>
<h6>This is a heading</h6>
By Muhammad Ismail
Paragraphs Paragraphs are defined with the
<p> tag.
<p>This is a paragraph</p>
paragraph.
By Muhammad Ismail
Line Breaks The <br> tag is used when you
want to end a line, but don't
want to start a new paragraph.
The <br> tag forces a line break
wherever you place it.
HTML
Lists (ul and ol)
By Muhammad Ismail
Html Lists With HTML, there are
three ways of adding
lists.
❏ Unordered Lists
❏ Ordered Lists
❏ Description Lists
By Muhammad Ismail
An unordered list starts with the <ul>
tag. Each list item starts with the <li>
Unordered List tag.
The list items will be marked with
bullets (small black circles) by default:
Example:
<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
By Muhammad Ismail
An ordered list starts with the <ol>
Ordered List tag. Each list item starts with the
<li> tag.
The list items will be marked with
numbers by default:
Example:
<ol>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
By Muhammad Ismail
HTML also supports description lists.
Example:
<dl>
<dt>Coffee</dt>
<dd>- black hot drink</dd>
<dt>Milk</dt>
<dd>- white cold drink</dd>
HTML
LINKS
By Muhammad Ismail
HTML Links - HTML links are hyperlinks.
Syntax
By Muhammad Ismail
The most important attribute of the <a>
Href Attribute
element is the href attribute, which
indicates the link's destination.
<a href="https://beqabil.com/">Visit
BeQabil!</a>
By Muhammad Ismail
Both examples above are using an
Absolute URLs vs. absolute URL (a full web address) in the
Relative URLs href attribute.
A local link (a link to a page within the
same website) is specified with a relative
URL (without the "https://www" part):
<h2>Absolute URLs</h2>
<p><a href="https://beqabil.com/">BeQabil</a></p>
<p><a href="https://www.google.com/">Google</a></p>
<h2>Relative URLs</h2>
<a href="mailto:[email protected]">Send
email</a>
Link title:
HTML
IMAGES
By Muhammad Ismail
Images can improve the design and the
HTML Images appearance of a web page.
Images Syntax
By Muhammad Ismail
The required alt attribute provides an
The alt Attribute
alternate text for an image, if the user
for some reason cannot view it (because
of slow connection, an error in the src
attribute, or if the user uses a screen
reader).
Example:
HTML
TABLES
By Muhammad Ismail
A table in HTML consists of table cells
HTML Table inside rows and columns.
Syntax:
<table>
<tr>
<th>Country</th>
</tr>
<tr>
<td>Germany</td>
</tr>
</table>
By Muhammad Ismail
Each table cell is defined by a <td> and a
Table Cells
</td> tag.
<table>
<tr>
<td>Emil</td>
<td>Tobias</td>
<td>Linus</td>
</tr>
</table>
By Muhammad Ismail
Each table row starts with a <tr> and
Table Rows ends with a </tr> tag.
<table>
<tr>
<td>Linus</td>
</tr>
<tr>
<td>10</td>
</tr>
</table>
By Muhammad Ismail
Sometimes you want your cells to be
Table Headers table header cells. In those cases use the
<th> tag instead of the <td> tag:
<table>
<tr>
<th>Person 1</th>
<th>Person 3</th>
</tr>
<tr>
<td>Emil</td>
<td>Linus</td>
</tr>
<table>
<tr>
<th colspan="2">Name</th>
<th>Age</th>
</tr>
<tr>
<td>Jill</td>
<td>Smith</td>
<td>43</td>
</tr>
By Muhammad Ismail </table>
HTML Table - Rowspan
Table Rowspan
To make a cell span over multiple rows, use
the rowspan attribute:
<table>
<tr>
<th>Name</th>
<td>Jill</td>
</tr>
<tr>
<th rowspan="2">Phone</th>
<td>555-1234</td>
</tr>
<tr>
<td>555-8745</td>
</tr>
By Muhammad Ismail </table>
Lecture 7
HTML
FORMS
By Muhammad Ismail
An HTML form is used to collect user input.
HTML Forms The user input is most often sent to a server
for processing.
Form Element:
<form>
form elements
</form>
Example:
<input type="text">
<input type="radio">
<input type="checkbox">
<input type="submit">
<input type="button">
By Muhammad Ismail
The action attribute defines the action to be
The Action Attribute performed when the form is submitted.
Example:
<form action="/action_page.php">
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname"
value="John"><br>
<input type="submit" value="Submit">
</form>
By Muhammad Ismail
The method attribute specifies the HTTP method to
The Method Attribute be used when submitting the form data.
Example:
● <input>
● <label>
● <select>
● <textarea>
● <button>
● <fieldset>
● <legend>
● <datalist>
● <output>
● <option>
By Muhammad Ismail ● <optgroup>
Here are the different input types you can use in
HTML Input Types HTML:
Example:
● <input type="button">
● <input type="checkbox">
● <input type="color">
● <input type="date">
● <input type="datetime-local">
● <input type="email">
● <input type="file">
● <input type="hidden">
● <input type="image">
● <input type="month">
● <input type="number">
● <input type="password">
● <input type="radio">
● <input type="range">
● <input type="reset">
● <input type="search">
By Muhammad Ismail ● <input type="submit">
The value Attribute
HTML Input
The input value attribute specifies an initial
Attributes value for an input field:
Example:
Input fields with initial (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">
By Muhammad Ismail
</form>
The readonly Attribute
HTML Input The input readonly attribute specifies that an input field
is read-only.
Attributes A read-only input field cannot be modified (however, a
user can tab to it, highlight it, and copy the text from it).
The value of a read-only input field will be sent when
submitting the form!
Example:
A read-only input field:
<form>
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname"
value="John" readonly><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname"
value="Doe">
By Muhammad Ismail </form>
The disabled Attribute
HTML Input The input disabled attribute specifies that an input field
should be disabled.
Attributes A disabled input field is unusable and un-clickable.
The value of a disabled input field will not be sent when
submitting the form!
Example:
A disabled input field:
<form>
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname"
value="John" disabled><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname"
value="Doe">
</form>
By Muhammad Ismail
Lecture 8
HTML
Html5 (Video & audio)
By Muhammad Ismail
The HTML <video> element is used to show a
HTML Video video on a web page.
Example:
<video width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
Your browser does not support the video tag.
</video>
By Muhammad Ismail
To start a video automatically, use the
HTML <video> autoplay attribute:
Autoplay
Add muted after autoplay to let your video
start playing automatically (but muted):
Example:
Example:
<audio controls>
<source src="horse.ogg" type="audio/ogg">
<source src="horse.mp3"
type="audio/mpeg">
Your browser does not support the audio
element.
</audio>
By Muhammad Ismail
The controls attribute adds audio controls, like play,
pause, and volume.
HTML Audio - How It
The <source> element allows you to specify alternative
Works audio files which the browser may choose from. The
browser will use the first recognized format.
Example:
HTML
Attributes, id and class difference
By Muhammad Ismail
HTML attributes provide additional
HTML Attributes information about HTML elements.
HTML Attributes:
● All HTML elements can have
attributes
● Attributes provide additional
information about elements
● Attributes are always specified in
the start tag
● Attributes usually come in
name/value pairs like:
By Muhammad Ismail name="value"
The <a> tag defines a hyperlink. The href
The href and src attribute specifies the URL of the page the link
Attribute goes to:
Example:
<a href="https://beqabil.com/">Visit
BeQabil</a>
Example:
Example:
Example:
By Muhammad Ismail
<p title="I'm a tooltip">This is a paragraph.</p>
You should always include the lang attribute
The lang Attribute inside the <html> tag, to declare the
language of the Web page. This is meant to
assist search engines and browsers.
Example:
<!DOCTYPE html>
<html lang="en">
<body>
...
</body>
By Muhammad Ismail
</html>
Difference between id HTML id Attribute:
Example:
Example:
HTML
Layout method
By Muhammad Ismail
Websites often display content in
HTML Layout
multiple columns (like a magazine or a
Elements newspaper).
By Muhammad Ismail
HTML has several semantic elements
HTML Layout
that define the different parts of a web
Elements
page:
● header
● nav
● section
● article
● aside
● footer
● details
By Muhammad Ismail ● summary