LAB 7
Objective:
To learn about html language and its tag
HTML Tags:
HTML tags are surrounded by two characters < and >
The surrounding characters are called angle brackets
HTML tags are used to mark-up HTML elements
HTML tags normally come in pairs like <b> and </b>
The first tag in a pair is the start tag, the second tag is the end tag
The text between the start and end tags is the element content
HTML Elements:
<html>
<head>
<title> My First Webpage </title>
</head>
<body>
This is my first homepage. <b>This text is bold </b>
</body>
</html>
This is an HTML element
<b>This text is bold</b>
The HTML element begins with a start tag: <b>
The content of the HTML element is: This text is bold
The HTML element ends with an end tag: </b>
The purpose of the <b> tag is to define an HTML element that should be
displayed as bold.
Nested Tags:
You may have noticed in the above example that the <body> tag also
contains another tag <b>. When you enclose an element within the
multiple tags, the tag you opened at the last should be closed first.
<p><b>This is not a proper way to close nested tags </p><b>
<p><b>This is a proper way to close nested tags </b></p>
Basic HTML Tags:
Tag Description
<html> Defines an HTML document
<body> Defines the document’s body
<h1> to <h6> Defines header 1 to header 6
<p> Defines a paragraph
<br> Defines a single line break
<hr> Defines a horizontal rule
<!--> Defines a comment
Headings:
Headings are defined with the <h1> to <h6>tags,<h1>
defines the largest heading while <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>
HTML automatically adds an extra blank line before and after a heading.
A useful heading attribute is align
<h5 align= “left” > Can align headings </h5>
<h5 align= “canter” >this is a centred heading </h5>
<h5 align= “right” >this is a heading aligned to the right </h5>
Paragraphs:
Paragraphs are defined with the <p> tag.
<p align= “left” >this is a paragraph </p>
Line Breaks:
The <br> tag is used when you want to start a new
line.
This Code Would display
<p> This <br> is a Para<br> This
Graph with line break </p> Is a Para
Graph with line break
The <br> tag has no closing rule.
Horizontal Rule:
The <hr> element is used for horizontal rule that
acts as divider between section, like this:
This Code Would Display
<hr width= “50%” align= “centre”> ________________
Comments in HTML:
The comment tag is used to insert a comment in
HTML source code.
This Code Would Display
<p> This HTML comment would <! This HTML comment would be
—This is a comment --> be displayed like this.
displayed like this. </p>
Other HTML Tags:
Tag Description
<b> Defines bold text
<big> Defines big text
<i> Defines italic text
<small> Defines small text
<sup> Defines superscripted text
<sub> Defines subscripted text
<ttp> Defines teletype text
<u> Deprecated. Use styles instead
Some Examples:
This Code Would Display
<abbr title= “World Wide WWW
Web”>www</abbr>
HTML Font:
The <font> tag in HTML is deprecated. The WWW
Consortium has removed the <font> tag from its recommendation. In
future versions of HTML, style sheets will be used to define the layout
and displayed properties of HTML elements.
The <font> tag should not be used.