Basic HTML Q1
Basic HTML Q1
com
How to use this Module?
Before you start answering the module, I want you to set aside other tasks that will
disturb you while enjoying the lessons. Read the simple instructions below to
successfully enjoy the objectives of this kit. Have fun!
• Follow carefully all the contents and instructions indicated in every page of
this module.
• Knowing the skills needed is important to develop and keep in mind.
• Perform all the provided activities in the module.
• Analyze conceptually the posttest and apply what you have learned.
• Enjoy studying!
Guide Icons
Table of Contents
LESSON 1
Introducing HTML
LESSON 2
Html Tags and Elements
LESSON 3
Creating Headings
LESSON 4
Creating Paragraphs
LESSON 5
Creating Line Breaks, Centering Content and Nonbreaking Spaces
LESSON 6
Presentational Tags
LESSON 7
Groupings
LESSON 8
HTML Fonts and Colors
Introducing HTML:
HTML stands for Hypertext Markup Language, and it is the most widely used
language to write Web Pages. As its name suggests, HTML is a markup
language.
• Hypertext refers to the way in which Web pages (HTML documents) are
linked together. When you click a link in a Web page, you are using
hypertext.
• Markup Language describes how HTML works. With a markup
language, you simply "markup" a text document with tags that tell a Web
browser how to structure it to display.
Originally, HTML was developed with the intent of defining the structure of
documents like headings, paragraphs, lists, and so forth to facilitate the sharing
of scientific information between researchers.
All you need to do to use HTML is to learn what type of markup to use to get
the results you want.
You have basic HTML document now, to see some result put the following code
in title and body tags.
Now you have created one HTML page and you can use a Web Browser
(Chrome, Explorer, or Mozilla Firefox browser) to open this HTML file to see the
result. Hope you understood that Web Pages are nothing but they are simple
HTML files with some content which can be rendered using Web Browsers.
NOTE: One HTML file can have extension as .htm or .html. So you can use
either of them based on your comfort.
An HTML document starts and ends with <html> which is the opening tag and
</html> which is the closing tag. The closing tag is the same as the opening
tag, except for the slash. These tags tell the browser that the entire document
is composed in HTML. Inside these two tags, the document is split into two
sections:
<html>
<head>
<title></title>
</head>
<body>
</body>
</html>
HTML language is a markup language and we use many tags to markup text.
In the above example you have seen <html>, <body> etc. are called HTML tags
or HTML elements.
Every tag consists of a tag name, sometimes followed by an optional list of tag
attributes, all placed between opening and closing brackets (< and >). The
simplest tag is nothing more than a name appropriately enclosed in brackets,
such as <head> and <i>. More complicated tags contain one or more attributes,
which specify or modify the behavior of the tag.
According to the HTML standard, tag and attribute names are not case-
sensitive. There's no difference in effect between <head>, <Head>, <HEAD>,
or even <HeaD>; they are all equivalent. But with XHTML, case is important:
all current standard tag and attribute names are in lowercase.
The basic structure for all HTML documents is simple and should include the
following minimum elements or tags:
Now we will explain each of these tags one by one. In this tutorial you will find
the terms element and tag are used interchangeably.
The <html> element is the containing element for the whole HTML document.
Each HTML document should have one <html> and each document should
end with a closing </html> tag.
• <head>
• <body>
As such, start and end HTML tags enclose all the other HTML tags you use to
describe the Web page.
The <head> element is just a container for all other header elements. It
should be the first thing to appear after the opening <html> tag.
Each <head> element should contain a <title> element indicating the title of the
document, although it may also contain any combination of the following
elements, in any order:
• The <base> tag is used to create a "base" url for all links on the page.
Check HTML Base tag.
https://lab.github.com/githubtraining/introduction-to-html
• The <object> tag is designed to include images, JavaScript objects,
Flash animations, MP3 files, QuickTime movies and other components
of a page. Check HTML Object tag.
https://www.tutorialspoint.com/html/html_object_tag.htm
• The <link> tag is used to link to an external file, such as a style sheet
or JavaScript file. Check HTML Link tag.
http://www.tutorialspoint.com/html/html_link_tag.htm
• The <style> tag is used to include CSS rules inside the document.
Check HTML Style tag.
http://www.tutorialspoint.com/html/html_style_tag.htm
• The <script> tag is used to include JAVAScript or VBScript inside the
document. Check HTML Script tag.
http://www.tutorialspoint.com/html/html_script_tag.htm
• The <meta> tag includes information about the document such as
keywords and a description, which are particularly helpful for search
applications. Check HTML Meta tag.
http://www.tutorialspoint.com/html/html_meta_tag.htm
Example:
<head>
<title>HTML Basic tags</title>
<meta name="Keywords" content="HTML, Web Pages" />
<meta name="description" content="HTML Basic Tags" />
<base href="http://www.tutorialspoint.com" />
<link rel="stylesheet" type="text/css" href="tp.css" />
<script type="text/javascript">
_uacct = "UA-232293";
urchinTracker();
</script>
</head>
You should specify a title for every page that you write inside the <title>
element. This element is a child of the <head> element). It is used in several
ways:
Therefore, it is important to use a title that really describes the content of your
site. The <title> element should contain only the text for the title and it may not
contain any other elements.
Example:
<head>
<title>HTML Basic tags</title>
</head>
The <body> element appears after the <head> element and contains the part
of the Web page that you actually see in the main browser window, which is
sometimes referred to as body content.
Most of what you will be learning in this module will be written between the
opening <body> tag and closing </body> tag.
Example:
<body>
<p>This is a paragraph tag.</p>
</body>
Now if we will put all these tags together, it will constitute a complete HTML
document as follows:
<head>
<title>HTML Basic tags</title>
<meta name="Keywords" content="HTML, Web Pages" />
<meta name="description" content="HTML Basic Tags" />
<base href="http://www.tutorialspoint.com" />
<link rel="stylesheet" type="text/css" href="tp.css" />
<script type="text/javascript">
_uacct = "UA-232293";
urchinTracker();
</script>
</head>
<body>
<p>This is a paragraph tag.</p>
</body>
</html>
Here's a table of some other attributes that are readily usable with many of
HTML's tags.
We will see related examples as we will proceed to study other HTML tags.
For a complete list of HTML Tags and related attributes please check reference
to HTML Tags List. https://www.tutorialspoint.com/html/html_tags_ref.htm
Lesson 3
Creating Headings
Any documents start with a heading. You use different sizes for your headings.
HTML also have six levels of headings, which use the elements <h1>, <h2>,
<h3>, <h4>, <h5>, and <h6>. While displaying any heading, browser adds one
line before and after that heading.
Example:
This is heading 1
This is heading 2
This is heading 3
This is heading 4
This is heading 5
This is heading 6
<html>
<head>
<title>My First Webpage</title>
</head>
<body>
<h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<h3>This is heading 3</h3>
<h4>This is heading 4</h4>
<h5>This is heading 5</h5>
<h6>This is heading 6</h6>
</body>
</html>
Lesson 4
Creating Paragraphs
Create Paragraph - The <p> Element:
The <p> element offers a way to structure your text. Each paragraph of text
should go in between an opening <p> and closing </p> tag as shown below in
the example:
<html>
<head>
<title>My First Webpage</title>
</head>
<body>
<p>Here is a paragraph of text.</p>
<p>Here is a second paragraph of text.</p>
<p>Here is a third paragraph of text.</p>
</body>
</html>
This is jutified. This works when you have multiple lines in your paragraph and you want to
justfy all the lines so that they can look more nice.
<html>
<head>
<title>My First Webpage</title>
</head>
<body>
<p align="left">This is left aligned.</p>
<p align="center">This is center aligned.</p>
<p align="right">This is right aligned.</p>
<p align="justify">This is jutified. This works when you have multiple lines in your paragraph
and you want to justfy all the lines so that they can look more nice.</p>
</body>
</html>
Note: The <br /> element has a space between the characters br and the
forward slash. If you omit this space, older browsers will have trouble rendering
the line break, while if you miss the forward slash character and just use <br>
it is not valid XHTML
Example:
Hello<br />
You come most carefully upon your hour.<br />
Thanks<br />
Mahnaz
Hello
Thanks
Mahnaz
You can use <center> tag to put any content in the center of the page
Suppose you were to use the phrase "12 Angry Men." Here you would not
want a browser to split the "12" and "Angry" across two lines:
A good example of this technique appears in the movie "12 Angry Men."
In cases where you do not want the client browser to break text, you should use
a nonbreaking space entity ( ) instead of a normal space. For example,
when coding the "12 Angry Men" paragraph, you would use something similar
to the following code:
Horizontal rules are used to visually break up sections of a document. The <hr>
tag creates a line from the current position in the document to the right margin
and breaks the line accordingly.
For example, you may want to give a line between two paragraphs as follows:
Again <hr /> tag is an example of an empty element, where you do not need
opening and closing tags, as there is nothing to go in between them.
Note: The <hr /> element has a space between the characters br and the
forward slash. If you omit this space, older browsers will have trouble rendering
the line break, while if you miss the forward slash character and just use <hr>
it is not valid XHTML
</body>
</html>
Lesson 6
Presentational Tags
Presentational Tags:
If you use a word processor, you are familiar with the ability to make text bold,
italicized, or underlined; these are just three of the ten options available to
indicate how text can appear in HTML and XHTML.
Anything that appears in a <b>...</b> element is displayed in bold, like the word
bold here:
The content of a <tt> element is written in monospaced font. Most fonts are
known as variable- width fonts because different letters are of different widths
(for example, the letter m is wider than the letter i). In a monospaced font,
however, each letter is the same width.
The content of a <sup> element is written in superscript; the font size used is
the same size as the characters surrounding it but is displayed half a
character’s height above the other characters.
The content of a <sub> element is written in subscript; the font size used is the
same as the characters surrounding it, but is displayed half a character’s height
beneath the other characters.
The content of the <big> element is displayed one font size larger than the rest
of the text surrounding it.
The content of the <small> element is displayed one font size smaller than the
rest of the text surrounding it.
</body>
</html>
Lesson 7
Grouping
Grouping - The <div> and <span> Elements :
The <div> and <span> elements allow you to group together several
For example, you might want to put all of the footnotes on a page within a <div>
element to indicate that all of the elements within that <div> element relate to
the footnotes. You might then attach a style to this <div> element so that they
appear using a special set of style rules.
Content Articles
The <span> element, on the other hand, can be used to group inline elements
only. So, if you had a part of a sentence or paragraph you wanted to group
together you could use the <span> element.
This is the example of span tag and the div tag alongwith CSS
These tags are commonly used with CSS to allow you to attach a style to a
For a complete list of HTML Tags and related attributes please check reference
to HTML Tags Reference.
<p>This HTML Tutorial is derived from <cite>World Wide Web Standard for HTML</cite>.</p>
This HTML Tutorial is derived from World Wide Web Standard for HTML.
Lesson 8
HTML Fonts and Color
HTML Fonts
The font tag is having three attributes called size, color, and face to customize
your fonts.
To change any of the font attributes at any time within your page, simply use
the <font> tag. The text that follows will remain changed until you close with the
</font> tag. You can change any or all of the font attributes at the one time, by
including all the required changes within the one <font> tag.
Font Size:
You can set the size of your font with size attribute. The range of accepted
values is from 1(smallest) to 7(largest). The default size of a font is 3.
Example:
Font size="1"
Font size="2"
Font size="3"
Font size="4"
Font size="5"
Font size="6"
Font size="7"
SPECIFY THE RELATIVE FONT SIZE. <font size="+n"> or <font
size="-n">: You can specify how many sizes larger or how many sizes smaller
Example:
Font size="-1"
Font size="+1"
Font size="+2"
Font size="+3"
Font size="+4"
Font Face:
You can set any font you like using face attribute but be aware that if the user
viewing the page doesn't have the font installed, they will not be able to see it.
Instead they will default to Times New Roman of your font with size attribute.
See below few examples on using different font face
Example:
<font face="Times New Roman" size="5">Times New Roman</font>
<font face="Verdana" size="5">Verdana</font>
<font face="Comic sans MS" size="5">Comic Sans MS</font>
<font face="WildWest" size="5">WildWest</font>
<font face="Bedrock" size="5">Bedrock</font>
A visitor will only be able to see your font if they have that font installed on their
computer. So, it is possible to specify two or more font face alternatives by
listing the font face names, separated by a comma.
Example:
<font face="arial,helvetica">
<font face="Lucida Calligraphy,Comic Sans MS,Lucida Console>
When your page is loaded, their browser will display the first font face that it
has available. If none of your selections are installed, then it will display the
default font face Times New Roman.
Font Color:
You can set any font color you like using color attribute. You can specify the
color that you want by either the color name or hexadecimal code for that color.
Example:
You can specify direct a color name to set text or background color. W3C has
listed 16 basic color names that will validate with an HTML validator but there
</body>
</html>