(Lesson 1) HTML Fundamentals
(Lesson 1) HTML Fundamentals
Always Remember:
❑ HTML is just a text structuring/formatting language for displaying
webpages. It’s NOT a programming language.
❑ HTML is NOT case-sensitive. <body> is the same as <BODY> or
<Body>.
HTML Structure
HTML code-view
<!DOCTYPE html> HTML browser-view
<html>
<head>
<title>My First Webpage</title>
</head>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>
Example Explained
Don't worry if this example uses tags you have not learned yet. You
will learn about them later.
All HTML documents may usually start with a document type
declaration: <!DOCTYPE html>.
The HTML document itself begins with <html> and ends with
</html>.
The visible part of the HTML document is between <body> and
</body>.
HTML Tags
Step 3: Save the file as an HTML file using the extension (.htm) or
(.html)
Step 4: Double-click on the HTML file to view the HTML page in your
browser.
IF you want to edit/modify the file you’ve created:
Step 5: Right-click on the HTML file, and open it with your HTML
editor (go through steps 1 to 4 again).
Basic HTML Tags
1. Headings
2. Paragraphs
3. Text formatting elements
4. Empty tags
5. Lists (ordered and unordered)
6. Images
7. Hyperlinks (Anchors)
8. Tables
9. Forms
1. Headings
<h1>,<h2>,<h3>,<h4>,<h5>,<h6>
HTML Headings
after a heading.
Use HTML headings for headings only. Don't use headings to make
text larger or bold. You will learn later how to change the font size.
Don’t worry about this now ☺
The HTML <head> element has nothing to do with HTML headings.
<!DOCTYPE html>
<html>
<body>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
</body>
</html>
HTML Paragraphs
<!DOCTYPE html>
<html>
<body>
<p>
This paragraph
contains a lot of lines
in the source code,
but the browser
ignores it.
</p>
</body>
</html>
HTML Paragraphs: Example 2
<!DOCTYPE html>
<html>
<body>
<p>
This paragraph contains
a lot of spaces in
the source code ,
but the browser ignores
it.
</p>
</body>
</html>
HTML Paragraphs: Example 2
(continued)
<!DOCTYPE html> To add more spaces within a text, you
<html>
<body> should use the special character
<p>
This is how
to make extra spaces
</p>
</body>
</html>
HTML Paragraphs: Example 3
<!DOCTYPE html>
<html>
<body>
<p>
The number of lines in a paragraph
depends on the size of the browser
window. If you resize the browser
window, the number of lines in this
paragraph will change.
</p>
</body>
</html>
3. Text Formatting Elements
<b>, <i>, <u>, <strike>, <sup>, <sub>,
<mark>
Text Formatting
An unordered list starts with the <ul> tag. Each list item starts with
the <li> tag. The list items will be marked with bullets by default.
<!DOCTYPE html>
<html>
<body>
<h3>An unordered HTML list</h3>
<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
</body>
</html>
HTML Lists: unordered list
You have the choice of three bullet types: disc (default), circle, square.
These are controlled by the “TYPE” attribute for the <UL> element.
<!DOCTYPE html>
<html>
<body>
<h3>An unordered HTML list</h3>
<ul type= "circle">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
</body>
</html>
HTML Lists: ordered list
An ordered list starts with the <ol> tag. Each list item starts with the
<li> tag. The items will be marked with numbers by default.
<!DOCTYPE html>
<html>
<body>
<h3>An ordered HTML list</h3>
<ol>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
</body>
</html>
HTML Lists: ordered list
</body>
</html>
HTML Images
The src, alt, width, and height are provided as attributes for the image:
1. The src attribute specifies the address of the image.
Unless specified, the browser expects to find the image in the same folder as
the web page:
Ex: <img src=“image1.png”>
If the webpage and image are stored in different directories, you must then
include the relative path of the image:
Ex: <img src=“multimedia/images/image2.gif”>
You can also access images from any web address in the world:
Ex: <img src=“http://www.abc.com/images/image3.jpg”>
HTML Images
</body>
</html>
HTML Hyperlinks (Anchors)
_top : Opens the linked document in the full body of the window
</body>
</html>