HTML 6
HTML 6
HTML 6
LEARNING OUTCOMES
1111
The internet is a network of millions of computers, which are connected with each other to
share informat ion and resources. Computers on the int ernet are either Servers or Clients and
communicate via networking protocol. The client s send request s to the servers and the servers
respond immediat ely with the required data.
The servers store files and information in the form of websites. These websites consist of
millions of pages called web pages, which cont ain, text, graphic, video, audio, and link to
the other pages called Hyperlink. These web pages can be accessed by different users around
the world by using an internet connection. Have you ever wondered how these web pages are
created? Which language is used to write these web pages? The answer is: HTML. HTML i s the
most widely used language t o design web content for the internet. In this chapter, you will be
introduced to the basics of t his technology.
HTML st ands for Hypertext Markup Language. It is a complet e code package t hat allows
you to create web pages that contain both text and graphics. It is a simple markup l anguage
that describes the st ruct ure and behaviour of the web document. All the web browsers are
designed to underst and and interpret this language.
Let us now break up the acronym HTML to see what it means.
Hypertext
Hypertext is a piece of ordinary text that has been spruced up with a special feat ure of linking
to the other document s or webpages. So, when you click on the hypert ext, it opens a new web
page.
Originally, HTML was developed with the intent of defining the structure
of documents to facilitate the sharing of scientific information between
researchers. Now, it is being widely used to format web pages with the
help of the different tags.
•} Tools to be Used
You require two basic tools to work with the HTML documents:
❖ HTML Editor - for creating and saving the documents An intranet is a corporate
organisational network
❖ Browser - for viewing the documents that uses the same
protocols used on the
internet to share files
HTML Editor and send e-mail. The only
difference between the
There are mainly two types of HTML editors. two is that an intranet is
cut off from the outside
WYSIWYG Editor world.
WYSIWYG stands for What You See Is What You Get. This type of web
editor allows a developer to see what the end result will look like while the document is being
created. These editors provide various tools and graphical interfaces where the web pages
are designed. While using a WYSIWYG editor, you do not require the knowledge of the HTML
commands as the elements (images, tables, lists, etc.) can be placed on the interface and the
required HTML code will be added automatically.
Text Editor
You can also create HTML documents using normal text editors, like Notepad or WordPad.
Unlike WYSIWYG editors, here, the developer is required to have proper knowledge of HTML
commands to develop the web pages. Atom, Notepad, Sublime Text are some of the popular
text editors used these days.
Browser
Web browsers are used to view the HTML documents. Some commonly used web browsers are:
.-:-
My f,m P,og,.m - Notepad 0 X
•) Creating an HTML Document Filo Edit Format v,..,, Holp
<ht111>
To create the HTML documents, you will be using the <head>
<title>
Notepad. Follow the steps given to create an HTML Hy First Program
</title>
document using Notepad. </head>
<body>
❖ Open Notepad by clicking on Start > Windows This 1s my first HTML progra11!! ! !!
</body>
Accessories > Notepad. </ht,wl>
❖ The Notepad window will appear. Figure 8.1: Creating a Web Page
using a Notepad
❖ Type the HTML code as shown in Figure 8.1. X
-
~
❖ You can also right-click on the file and select the Open with option from the Shortcut
menu. Select Google Chrome from the sub-menu to view the web page.
Tags
Tags are the building blocks of a web page. They have elements that define how the informati on
on a web page is formatted or displayed. You can also include non-text items, such as i mages,
links, and lists on the web page using the text. Tags do not appear in the browser window but
they affect the display of the text and non-text items in it. Each tag in HTML follows specific
rules and syntax. These tags are not case sensitive, for example, <tag name> and <TAG NAME>
will have the same effect. The HTML tags or commands are inserted before and after the text.
Each tag, gi ving a specific instruction, begins with a less than sign '<' and ends with a greater
than sign '>' .
For example, the tag for defining a paragraph is <p>.
You use <p> before the block of the text that you want to designate as a paragraph. This is the
opening tag or the on tag. At the end of the text block, you place </p>. This is the closing tag
or the off tag. So, to define a paragraph, you will type the following in the text editor:
❖ Empty Elements
Container Elements
The elements that include both on and off tags are called container elements. For example,
the <b> tag.
Empty Elements
Empty elements have only on tags. They do not have off tags. These elements do not enclose
any data; instead they perform some function on their own.
For example, the <br> tag.
Attribute
An Attribute is the property that provides additional information about an HTML element. It
enhances the functionality of a tag. An attribute is always specified inside the openi ng tag. All
attributes consist of two parts-a name and value. The 'name' i s the property that you want to
set and the 'value' is what you want for the respective property. The Attribute value is always
enclosed within the quotes. You can use more than one attribute inside a tag.
For example, the width attribute of the <hr> tag specifies the width of the horizontal line in
pixels or percentage. By default, the width of the horizontal rule is 100%.
So, if you write <hr width=50%>, the horizontal line will cover only 50% of the page.
❖ Tags and attribute names are not case-sensi tive, so <Head>, and <head> have the same
meaning. However, using lower case is recommended.
❖ Container tags should always be closed because an unclosed tag
can lead to undesired results.
Know the Fact
❖ Values given to the attributes should be enclosed within quotes Opera, a popular web
browser by Opera
especially if the value has any blank space. Software, is known for its
featu res, like download
❖ Attribute values can be case sensitive. manager, inbuilt phishing,
and malware protection,
❖ When the tags are embedded, i.e., when you start a tag within etc. It is also the default
integrated browser for
another tag, you need to close the inner tag before closing the various mobiles.
outer tag.
Body Section
The body section contains the text that gets displayed on the web page
along with the other tags and attributes. It includes text, graphics, and
the other HTML elements that provide control and formatting to a page,
like fonts, paragraph, list, and the other elements. Let us discuss the
basic structure of an HTML document.
❖ The HTML document starts with <html> tag and ends with </html>
tag. Everything is written within these tags. If the commands are
Know the Fact
not enclosed in the <html> tags then a web browser will assume the The <meta> tag, which is
commands as text. placed inside the <head>
element, is used to specify
❖ The <head> tag is the HTML document header. It lies just below the page description,
keywords, and other
the <html> tag. It contains the information that is important about metadata (information
about data) of t he HTML
the web page, but is not seen in the browser window. The <head> document.
contains no text within itself.
❖ The <title > tag is to be used within the <head> tag. It contains t he t itle of the document.
The t itle is di splayed on the title bar at the top of the browser window and not i nside the
window itself. The t itle should be short and include less than 64 characters.
❖ The <body> tag contains the contents of your document that gets displayed on the web
page i n your browser window. In the <body> tag, you use the number of the formatting
elements, images, headi ng, list, and hypertext links to enhance the appearance of a web
page.
❖ Text-level Elements: The Text-level elements are used to markup the bits of text . They do
not start on a new line and only take up as much width as necessary. These i nclude tags,
li ke: Bold <b>, Italics <i >, and Line break <br>.
.....-- <html>
<head> D X
~ Tit'e of the v.eb ~ge X
<title>
Titl e of the web page
C (D file;///C:/Users/User/Desktop/Ne~20folder'N ~ * J
[
</ti tle> Text, which you want to show on your web page
will be 2-i\-en here.
</head> ~ ~
<body>
Text, which you want
to show on your web
page <br> will be
given here.
</body>
~ - < /html>
The main functional difference between the block-level and text-level elements is that the bloc~
level elements do cause line breaks whereas the latter does not cause any line breaks.
Heading
The Heading tag is used to define different heading levels i n an HTML document. It is basically
used to emphasise the text. There are six heading levels, H1 to H6. The H1 headi ng style
displays the text in the largest size and is mainly used for main headings. The lower levels are
used for sub headings and less important text. It is not essential to use these heading levels in
hierarchy. These heading tags are written within the <body> tag of the document.
<html >
<head>
<t it l e> Usi ng Heading St yles</title>
</head>< body>
<hl> KIPS LEARNING PVT. LTD. - (Hl )</hl>
<h2> KIPS LEARNING PVT . LTD. - (H2)</h2>
<h3> KIPS LEARNING PVT. LTD. - ( H3)</h3>
<h4> KIPS LEARNING PVT . LTD. - ( H4)</h4>
<h5> KIPS LEARNING PVT. LTD. - ( H5)</h5>
<h6> KI PS LEARNING PVT . LTD. - (H6 ) </h6>
</ body>
</ht ml>
Paragraph
To display a long piece of text on a web browser, the paragraph element <p> is used, which
marks a block of text as a paragraph. To mark the end of a paragraph, the </p> element is
used. When you start another paragraph, the web browser will leave one line between the
two paragraphs.
<html>
<head>
<title> Line break e l ement </tit l e>
</head>
<body>
Kips Learning Pvt . Ltd . <br>
B-40, Sector- 57, <br>
Naida <br>
Pin-201305 <br>
Ph - 8130100096
</body>
</html>
Horizontal Rule
The Horizontal Rule is used as a separator between the blocks of text. The <hr> element
draws a horizontal line across the page. It is an empty element and has no end tag. Type <hr>
where you want to insert a horizontal line in between the text.
Comment
So far you have seen that whatever you write inside the body tag, it gets displayed in the
web browser. Sometimes, you want to write notes for yourself in an HTML document, but do
not want them to be displayed in the browser window. In such a case, you need to use the
Comment tag. You can add a comment in a web page in any of the following ways:
Bold
The bold tag is used when you need to emphasi se the text. Type <b> before typing the t ext
that you want to display as bold and type </ b> after the text.
Italics
To draw the attention of a reader towards any important i nformation, the italics tag is used .
This element marks up the text in italic style. Type the <i> tag before typing the text that you
want to display in italics and type the </i> tag after the text.
For example: <i> Organised by: KIPS Learning Pvt. Ltd. </i>
Underline
The <u> tag is used for the section of text that is unarticulated and styled differently from
normal text , such as misspelled words.
. L D. - H4·l
l
<html >
<head>
<t itle> Us i ng Bold , I t alics & Underl i ne
</title>
</head>
<body>
<!-- In thi s program you have used
Fo rmatting effect s on t he text. -->
<b> KIDS POOL - A COMPUTER COURSE </b> <br>
<i> Organised by : KI PS Lea r ning Pvt . Lt d.</i> <br>
<u> Elij i bility : </u> St udent s of cl asses 6 t o 8
</body>
</ht ml>
❖ Control layout of many documents from one single style sheet (External Style Sheet)
CSS Terminology
Property
It defines how different elements look on the w eb page. Font-family, colour, background,
border, etc., all are examples of the properties.
Value
Thi s is the value or option chosen for a property.
For example: Value for the Font-family property can be font names, like Monotype Corsiva,
Times, Arial, etc.
0 al r e
I
"!f · in;.· L-tn1, j11g Pvt_
_!ij~--. tude ·ts of cla3ses 6 to
Unde:llline !Effect
Declaration
[black
Colour
■ white - □
'
A property and its value are collectively known as a Declarati on. red ■ blue ■
yellow
□ fuchsia ■
m aroon ■ olive ■
For example: Color : Green grey ■ purple
■
~
1191 green
lime ■
(Prore~ ....
aqua
orange
□ navy
Cl teal - ■
■
silver □ tan □
Selector dooge,blue ■ firebrick
■
peachpuff D aquamar ineO
It is the name of the HTML element to which you want to apply the RGIICodes
-
Maroon '111>{128.D,OI ■
Geld
PINc
Peadlpuff
rcl>{D, 255, 2551 Cl
rcl>{220, 20, 60) ■
rcl>(ua. o. 226) ■
rcl>{2S5. 215, DJ C
rcl>{2S5, 192, 2030
rcl>{2S5, 218, 1850
- Hex.adedmal Codes
IIIOIJOOO • llOOffOO
■
Rule -#ffOOOO
#ffASOO □
• #008000 •
I000080 •
Selector and declaration together form a Rule. #ffflOO
#808000 . □ llOOOOff
IOOfflf
•
C
#800080 IJ I008080 •
Declaration Property Value #ffOOff ■ llOOOOOO ■
I t I I I
Hl { Color: blue; font-size : 20 px;}---? Rule
#fffffl
#808080 •
□ kOdlcO
□
. i
l l I I
-,
Example Value
Property
J
Declaration
Selector
For example: <hr style = "width : 50%; height : 100; background-color : blue">
This is not an efficient use of style sheet as the declaration is to be repeated with every
element, even if the same style is applied on some other element in a document.
This method incorporates two files. One file contains the style code only and the other file
contains the HTML code.
Let us use the style sheets to set the various properties of body background. In this chapter,
the embedded style sheets method will be used.
~} Background Properties
HTML allows you to set the background style of an element with the help of the following
properties:
Background Color
Thi s property is used to set the background colour of the HTML element.
<html>
<head>
<t itle> Using Background Color Proper ty </ tit l e>
<style type = "text/css">
( selector)
body {background - color yellow}
~
</style>~
( Value )
</head >
<body>
•..
•
Background Image
With thi s property, you can add an image in the background of an HTML document.
<html>
<head>
<style type= "text/css">
body{background-image:url("C:/
Users/User/Desktop/Html/Teamwork . png")}
</style>
</head>
<body>
<p> Teamwork is so important that it i s
virtually impossible for a person to reach the heights of his capabilities or
make the money that he wants without becoming very good at it.
</p>
</body>
</html>
Background Position
This property helps you in placing the picture or image at a desired place on t he HTML
document. By default, an image is placed at the top-left corner of the element.
where value = xpos ypos Ix% y%I [top I center I bottom] I I [left I center I right]
❖ xpos ypos: It specifies the horizontal, vertical position, respectively in units of length.
❖ x% y%: It refers to the horizontal and vertical position in percentage.
❖ [top I center I bottom] I I [left I center I right]: These keywords also specify the vertical
and horizontal posit ion values, respecti vely. Values are to be chosen i n conjuncti on from
both the sets specified above.
t I
Backgro rnd
Image ,epeated
Background Repeat
With the help of this property, you can set the repetition pattern for the background image.
By defaul t , a background image is repeated in both horizontal and vertical directions.
Background Attachment
This property helps in either fixing the image in the background or make it scroll when the user
scrolls the rest of the page.
<html>
<body>
•) Text Properties
HTML allows you to set the text style with the help of the following properties:
❖ Color ❖ Font ❖ Size
r,
Because of
bac .ground-repeat:
no-~p~31lf u,e image
is. ot rep:eated
Text Color
This property is used to set the colour of the text.
Syntax: color: value
Text Font
This property is used to set the font of the text.
Syntax: font-family: value
Text Size
This property is used to set the size of the text.
Syntax: font-size : value
where value= size i n pixels
For example: <p style="font-size:30px">This is a paragraph. </p>
<p style="font-size: 11 px">This i s another paragraph. </p>
<html>
<head><title>Text proper ties</title>
</head>
<body>
Text properties
<p style="color:red">This is a paragraph . </p>
<p style="color:blue">This is another paragraph.</p>
<p style="font-family :Verdana " >This is a paragraph . </p>
<p style="font -family :"Courier New">This is another paragraph . </p>
<p style="font - size:30px">This is a paragraph . </p>
<p style="font-size:11px">This is another paragraph . </p>
</body>
</html>
e © Fil: F: c:d:..n Ml
• □ X
T is is a paragiap·b,.
:n.c. iilUd:i.:.it-.1
-+ HTML is the most widely used language to design web contents for the internet.
-+ The internet is a network of millions of computers, which are connected with each
other to share information and resources.
-+ Two basic tools are required to work with the HTML documents are HTML editor and a
browser.
-+ HTML code is made up of elements, tags, and attributes.
-+ HTML elements are of two types, Container and empty.
-+ The general structure of an HTML document has two sections, Head and Body.
-+ CSS is a style sheet that provides a set of style rules for defining the layout of HTML
documents.
-+ You can include the style sheet with an HTML document in three ways, in-line, internal
or embedded, and external.
-+ HTML allows you to set the background style of an element with the background
properties.
-+ HTML allows you to set the text style with the text properties.
3. The background ....................................... property helps you in placing the picture or image
at a desired place on the HTML document.
5. The ....................................... element splits the line and displays the text on a new line.
1:tmtt>
• Position • Hypertext • Line Break • Web Browsers • Contai ner
B. Write T for True and F for False.
1. The <hr> element is an empty tag. D
2. Tags and attribute names are case-sensitive. D
3. Property defines how different elements look on the web page. D
4. With the lnline method, the effects get applied to all the elements of the web page. D
5. You can add an image in the background of a web page with the help of the D
picture tag.
C. Application-based questions.
1. Rashmi wants to set the image of a zoo as the background of her web page but she is
unable to do it. Which tag should she use to do so? Give the syntax.
2. Raghav wants to place the logo of his school on the top-left corner of the web page. How
can he do so? Give the syntax.
2. Froala is a ....................................... .
a. Text editor b. Web editor c. Word editor
3. The ....................................... tag draws a horizontal line across the web page.
a. <br> b. <hr> c. <line>
4. ....................................... provides a set of style rules for defining the layout of the HTML
documents.
1 . What is HTML? What are the basic tools required to work with the HTML documents?
2. Explain the terms tags and attributes with the help of an example.
4. How are comments useful? What are the two ways in which you can add comments?
5. What are Cascading Style Sheets? Name the different methods available for applying Style
rules in an HTML document.
6. Name any two text properties that can be applied in CSS. Give the syntax.
0 e :1r
~~
Create the given web page using HTML. Follow the given instructions.
+ Give a title to the web page as 'World 0 • • ♦ 0 -ClC
+ Apply Heading level 3 to the text · • • - • •• •liola.ilt -.,1 ... '" ., I ....... ...
+
■•..81111ij111•111..•)1111:j...•111111111..•_.•J:11111
;1 1111(_.•1l 1:11
•.__ _ _ For Concept C
_l_
a r_it_y_ _ __
Using Creativity
Create a web page for the website of your school, which will display the first three
rank holders of classes 1-12. The title of the page should be: Achievers of the Year.
Make use of the appropriate tags and different background properties.