To HTML: UICT 2024
To HTML: UICT 2024
TO HTML
UICT 2024
Introduction
UICT 2024
Advantages and Disadvantages of HTML
UICT 2024
HTML Tools
HTML Editor
Program one uses to create and modify HTML documents.
Examples:
Basic needs: Notepad, TextEdit, or Notepad++.
Advanced coding: VS Code, Sublime Text, Atom, or
Brackets.
WYSIWYG design: Adobe Dreamweaver or BlueGriffon.
Quick online editing: CodePen, JSFiddle, or JSBin.
Web Browser
Program one uses to read and display HTML documents. They
translate HTML encoded files into text, image, sounds and
other features user see.
Examples of web browsers include: Microsoft Internet
Explorer, Netscape, Mosaic Chrome,
UICT 2024 Edge, Firefox, safari etc
HTML Structure and Explanation
<!DOCTYPE html> The <!DOCTYPE html>: defines
<html> that this document is an HTML5
<head> document
<title>Page Title</title> The <html> element: is the root
</head> element of an HTML page
<body> The <head> element: contains
meta information about the HTML
page
The <title> element: specifies a title
</body> for the HTML page (which is shown
</html> in the browser's title bar or in the
page's tab)
The <body> element: defines the
document's body, and is a container
for all the visible contents, such as
headings, paragraphs, images,
UICT 2024
tables, lists, forms, hyperlinks etc.
HTML Elements (Tags)
An HTML element is defined by a start tag, some content,
and an end tag.
Syntax: <tagname> Content </tagname>
Example: <p> My first paragraph </p>
Note: Some HTML elements have no content (like the
<br>, hr elements). These elements are called empty
elements (tags). Empty elements do not have an end tag!
HTML tags are not case sensitive: <P> means the same
as <p>. However, W3C recommends lowercase in HTML.
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: name="value" UICT 2024
HTML Headings
HTML headings are titles or subtitles that you want to
display on a webpage.
Example
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
UICT 2024
Example
<html>
<head>
<title> HEADHING </title>
</head>
<body>
<h1>HEADING 1</h1>
<h2>HEADING 2</h1>
<h3>HEADING 3</h3>
……
……..
<h6>HEADING 6</h6>
</body>
</html>
Save this as head.html or head.htm
UICT 2024
HTML PARAGRAPHS
UICT 2024
1. HTML Paragraphs
The HTML <p> element defines a paragraph.
A paragraph always starts on a new line, and browsers
automatically add some white space (a margin) before and
after a paragraph.
Example:
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
Paragraph Attributes
UICT 2024
1. HTML Paragraphs
lang: Specifies the language of the paragraph's content.
Example:
<p lang="en">This paragraph is in English.</p>
<p lang="es">Este párrafo está en español.</p>
dir: Defines the text direction. Values can be ltr (left to right)
or rtl (right to left).
Example:
<p dir="rtl">This paragraph's text flows from right to left.</p>
hidden: Hides the paragraph from the webpage, though it
remains in the HTML code.
Example:
<p hidden>This paragraph will not be displayed.</p>
UICT 2024
Example shows the use of <p>,<br> and <pre>
<html>
<head>
<title>Use of Paragraph, Line break and preformatted text Tag </title>
</head>
<body>
<p>HTML Tutorial </p>
<p> HTML stands for Hypertext Markup Language.<br>
It is used for creating web page. It is very simple <br>
and easy to learn.<br>
</p>
<pre>
My Bonnie lies over the ocean.
Output:
Your horizontal rule goes here.
UICT 2024
Example:
<PRE>
The copyright symbol is: ©
The registered rank is: ®
</PRE>
• Output:
The copyright symbol is:©
The registered rank is:®
UICT 2024
Formatting elements were designed to display special types
of text:
Output:
Output: i.HTML
I.HTML ii.Java
II.Java iii.JavaScript
III.JavaScript iv.SQL
IV.SQL
Types of Ordered List or Numbered List
ol type = “A” ol type = “a”
1.<ol type="A"> 1.<ol type="a">
2. <li>HTML</li> 2. <li>HTML</li>
3. <li>Java</li> 3. <li>Java</li>
4. <li>JavaScript</li> 4. <li>JavaScript</li>
5. <li>SQL</li>
5. <li>SQL</li>
6.</ol>
6.</ol>
Output
A. HTML Output:
B.Java a.HTML
C.JavaScript b.Java
D.SQL c.JavaScript
d.SQL
Ordered List start
attribute
The start attribute is used with ol tag to specify from where to
start the list items.
<ol type="1" start="5"> : It will show numeric values
starting with "5".
<ol type="A" start="5"> : It will show capital alphabets
starting with "E".
<ol type="a" start="5"> : It will show lower case alphabets
starting with "e".
<ol type="I" start="5"> : It will show Roman upper case
value starting with "V".
Ordered List reversed Attribute
Example
1.<ol reversed>
2.<li>HTML</li>
3.<li>Java</li>
4.<li>JavaScript</li>
5.<li>SQL</li>
6. </ol>
HTML Unordered List | HTML Bulleted List
HTML Unordered List or Bulleted List displays elements in
bulleted format.
The HTML ul tag is used for the unordered list.
There can be 4 types of bulleted list:
Examples of Unordered List
1.<ul> 1.<ul type="square">
2. <li>HTML</li> 2. <li>HTML</li>
3. <li>Java</li> 3. <li>Java</li>
4. <li>JavaScript</li> 4. <li>JavaScript</li>
5. <li>SQL</li>
5. <li>SQL</li>
6.</ul>
6.</ul>
Output:
Output: HTML
o HTML Java
o Java JavaScript
o JavaScript SQL
o SQL
Inserting an image on a web page with <img> tag:
As mentioned earlier, the <img> tag is an empty tag, it
contains attributes only, and dose not have a closing tag
Image attributes:
src Specifies the path to the image file (relative or
absolute)
alt Specifies an alternate text for an image, if the
image cannot be displayed
height Number of pixels of the height
width Number of pixels of the width
border Size of border, 0 for no border
29
Example using <img> attributes
1. <!DOCTYPE html>
2. <html>
3. <body>
4. <h2>Alternative text</h2>
5. <p>The alt attribute should reflect the image content, so
users who cannot see the image get an understanding of
what the image contains:</p>
6. <img src="chania.jpg" alt="Flowers in Chania" width="460"
height="345">
7. </body>
8. </html>
Assignment
1.How to display images in Another Folder
2.How to display images on another
UICT 2024 server or website
HYPERLINKS: <a> TAG
Hyperlinks allow users to navigate to different locations,
either within the same document, another document, or a
web page.
The syntax for hyperlink is: <a href="url">link text</a>
There are three common types of hyperlinks:
Absolute,
Relative,
Bookmark.
UICT 2024
HYPERLINKS: <a> TAG
2. Relative hyperlink
<h2>Absolute URLs</h2>
<p><a href="https://www.w3.org/">W3C</a></p>
<p><a href="https://www.google.com/">Google</a></p>
<h2>Relative URLs</h2>
<p><a href="html_images.asp">HTML Images</a></p>
<p><a href="/css/default.asp">CSS Tutorial</a></p>
</body>
</html> UICT 2024
HYPERLINKS: <a> TAG
3. Bookmark (Internal) Hyperlinks
Example
First, create a named anchor or ID in the HTML:
<h2 id="section1">Section 1</h2>
Then, create a hyperlink to that section:
<a href="#section1">Go to Section 1</a>
Clicking the link will scroll the page to the location marked by the
anchor #section1. UICT 2024
HYPERLINKS: <a> TAG
Conclusion
Hyperlinks are a fundamental aspect of web navigation.
Absolute links are best for external websites
Relative links for internal navigation within the same website
Bookmark links for navigating within a single page or
document.
UICT 2024
HYPERLINKS: <a> TAG
HTML Links - The target Attribute
UICT 2024
HYPERLINKS: <a> TAG
Example of target attribute
1. <!DOCTYPE html>
2. <html>
3. <body>
4. <h2>The target Attribute</h2>
5. <a href=https://www.w3schools.com/ target="_parent">Visit
W3Schools!</a>
6. <p>If target="_blank", the link will open in a new browser
window or tab.</p>
7. </body>
8. </html>
UICT 2024
HTML TABLES
HTML tables allow web developers to arrange data into rows
and columns
Some of the HTML table tags include:
UICT 2024
HTML TABLES
UICT 2024
HTML TABLES
Output
UICT 2024
HTML TABLES
Colspan attribute
Used to make a cell span over two or multiple columns.
<table>
<tr>
<th colspan="2">Name</th>
<th>Age</th>
</tr>
<tr>
<td>Jill</td>
<td>Smith</td>
<td>50</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
</table> UICT 2024
HTML TABLES
Rowspan attribute
UICT 2024
HTML FORMS
An HTML form is used to collect user input. The user input
is most often sent to a server for processing.
Some of the common tags include:
UICT 2024
HTML FORMS
The <form> Element
The <form> element is used to create an HTML form for user
input.
The <form> element is a container for different types of input
elements such as text fields, checkboxes, radio buttons, submit
buttons etc.
UICT 2024
HTML FORMS
The <input> Element
The HTML <input> element is the most used form element.
An <input> element can be displayed in many ways, depending
on the type attribute.
Examples of the common input elements
UICT 2024
1. Introduction to HTML5; Laying out a page with HTML5,
page structure, new HTML5 structure tags, page
simplification. [3 LH 3 PH]