You are on page 1of 8

Chapter 5 HTML-I (Basic HTML elements)

Q1:- HTML AND ITS FEATURES


Ans:- HTML is a document-layout and hyperlink- specification language i.e., a language used to design the
layout of a document and to specify the hyperlinks.
HTML tells the browser to display the contents of a hypertext documents. i.e. a document including text,
images and other support media. The language also tells how to make a document interactive through special
hyperlinks.
Though HTML is a language that supports multimedia and new page layout features yet it has its limitations.
Limitations:-
HTML is not a word processing tool; it is not a desktop publishing solution or even a programming language. It
is just a page-layout and hyperlink specification language.

Q2:- Define the basic structure of HTML Document/web page.


Ans:- An html document consists of text, which comprises the content of the document, and tag, which defines
the structure and appearance of the document. Every HTML document should follow this form:
<HTML>
<HEAD> <TITLE> </TITLE>
</HEAD>
<BODY>
</BODY>
</HTML>
<html> tag
It identifies the document as an HTML document. <HTML> marks the beginning of the document. </HTML>
marks the end of the document.
<HEAD> tag
It contains information about the document, including its title, scripts.
<Title> tag
It contains the document title which appears on the browsers’ title bar. Title can be maximum of 64 characters.
<body> tag
It includes all the tags, attributes and information to be displayed in the web page.

Q3:- Is HTML case sensitive?


Ans:- no, it is not. <TITLE>,<title>,<Title> is treated same.

Q4:-What are tags and attributes?


Ans:- A tag is coded HTML command that indicates how part of web page should be displayed.eg. <body>,
<html> etc.
An Attribute is a special word used inside tag to specify additional information to tag such as color, alignment
etc. eg.<Body BGCOLOR=”red” text=”white”>

Q5:-What are the two types of tags/elements/document tag?


Ans:- there are two types of tags
a) Container tags:- it requires a starting as well as an ending tag. Eg. <body> ,<html>, <head> etc.
b) Empty tags:- it requires just a starting tag and not an ending tag. Eg. <br>, <hr> etc.
Q6:- Structure of HTML tags
Ans:- The structure of HTML tag is being discussed in following lines :
i) Every HTML tag consists of a tag name , sometimes followed by an optional list of attributes, all
placed between opening and closing angle brackets (< and >).
ii) Tag attributes, if any, come after the tag name, each separated by one or more tab, space, or return
characters. Their order of appearance is not important.
iii) A tag attribute’s value is given after (=),in quotes generally after the attribute name and is limited to
1024 characters.
<body bgcolor=red background=”abc.html”>
If the attribute value is a single word or number, then you can omit quotation marks.
Q7:- Define HTML tag with its attributes.
note
Type: Container tag/element
Attribute:- DIR, LANG
Contains: <Head>,<body> tag
Ans:- It identifies the document as an HTML document. <HTML> marks the beginning of the document.
</HTML> marks the end of the document.
i) DIR attribute: (direction):- It specifies the way text would be displayed in the browser. It can have
values either ltr(left to right) and rtl (right to left). By default text would be ltr. The value rtl is used
for languages like Chinese and Hebrew. Eg.
<HTML dir=ltr>
ii) LANG attribute: (language):- it specifies the language used within the document. Example
<HTML lang=en>
Q8:- Define Body tag with its attributes.
Note
Type: Container tag/element
Attribute:- BGCOLOR,BACKGROUND,VLINK,LINK,ALINK,TEXT,LEFTMARGIN,TOPMARGIN

Ans:-It defines the document’s body. It contains all the content of an HTML document, such as text, images,
lists, tables, hyperlinks etc.
Attributes of Body tag
1. BGCOLOR:- It is used to give background color. Eg <body BGCOLOR=”red”> the default
background color is red.
2. Background:- it is used to insert background image. .jpeg (joint picture expert group), .png (portable
network graphic, .gif (graphic interface format), .bmp (bitmap) can be inserted. Example <body
background=”abc.jpg”>
3. Text:- It is used to change text color. Example <body text=”red”>. The default text color is black.
4. Leftmargin:- it is used to change the left margin. 72 pixel is equivalent to one inch. Example <body
leftmargin=72>
5. Topmargin:- it is used to change the topmargin. 72 pixel is equivalent to one inch. Example <body
topmargin=72>
6. Link :- it is used to change default hyperlink colour which is blue.
7. VLink(visited link) :- it is used to change default visited hyperlink colour which is purple.
8. ALink :- it is used to change default active hyperlink colour which is red.
Example: <Body link=pink vlink=yellow alink=green>
Note :- <body bgcolor=”#000000”> gives black
<body bgcolor=”#FFFFFF”> gives white

Q9:- Define headings in HTML.


Ans:- HTML has 6 levels of headings h1,h2,h3,h4,h5,h6. Headings are container tags. These are differentiated
from each other through these factors: typeface, pointsize and the space above and below them.<h1> is largest
heading in size and <h6> is smallest heading in size. Example
<html>
<body>
<h1> computer </h1>
<h2>computer </h2>
<h3> computer</h3>
<h4>computer</h4>
<h5> computer</h5>
<h6>computer</h6>
</body>
</html>
Align attribute:- the default alignment is left. The justified alignment is not supported by any browser
yet.eg
<h1 Align=right> computer </h1>

Q10:- Define <p> tag.


Ans:- Paragraph tag <p> is used to write paragraph. it is container tag. It leaves one blank line after and
before the paragraph. it is by default left align. Example
<html>
<body>
<p align=right> this is an example of paragraph </p>
</body>
</html>

Q11:- Define line break.


Ans:- it is used to insert a line break. It is an empty tag. Example
<html>
<body>
This is an example of <br>
Line break.
</body>
</html>

Q12:- Define <pre> tag.


Ans:- it is used to display the text exactly in the same way as you have typed in the code i.e., with all blank
line, tabs etc, you may enclose this text in <pre>---</pre> tags.
<html>
<body>
<pre> this is an example of preformatted text </pre>
</body>
</html>

Q13:- Define <CENTER> tag.


Ans:- It is used to centralize a segment of text.
<html>
<body>
<CENTER> COMPUTER </CENTER>
</BODY>
</html>

Q13:- Define <BASEFONT> tag with all its attributes.


Ans:- 1. It is used to define the basic size, style, colour of the font for the web page.
2. it is container/empty tag.
3. it has three attributes : face, size, color.
4. The default font size is 3 , maximum size is 7 and minimum is 1.( Size range from 1 to 7). This is called
absolute size. The relative font size is given as size=+1 , which means 20% more than 3 will result in font
size 4. Size=-1 means 20% smaller than 3 ,which means font size 2.
5. Each virtual size is successively 20% larger and smaller than the default font size 3. THUS, font size 4 is
20% larger, font size 5 is 40% larger , and so on. 2 is 20% smaller than 3 soon.

Attribute:-
1. Face : it specifies font style. The user can give three styles wth this attribute.eg.
<basefont face=”broadway, arial, times new roman”> computer </basefont>
If broadway is unavailable then browser takes “arial” ,if ‘arial’ is unavailabl then “times new roman”. If
all three are unavailable then browser renders the text with default font.
2. color: it specifies font color.eg.<basefont color=red>
3. Size: it specifies font size. Eg.<basefont size=4>

Q14:- Define <FONT> tag with all its attributes.


Ans:- 1. It is used to define the basic size, style, colour of the font for the segment of the text.
2. it is container tag.
3. it has three attributes : face, size, color.
4. The default font size is 3 , maximum size is 7 and minimum is 1.( Size range from 1 to 7). This is called
absolute size. The relative font size is given as size=+1 , which means 20% more than 3 will result in font
size 4. Size=-1 means 20% smaller than 3 ,which means font size 2.
5. Each virtual size is successively 20% larger and smaller than the default font size 3. THUS, font size 4 is
20% larger, font size 5 is 40% larger , and so on. 2 is 20% smaller than 3 soon.
Attribute:-
2. Face : it specifies font style. The user can give three styles wth this attribute.eg.
<font face=”broadway, arial, times new roman”>
<p> This an example of font tag</p>
</font>
If broadway is unavailable then browser takes “arial” ,if ‘arial’ is unavailable then “times new roman”.
If all three are unavailable then browser renders the text with default font.
4. color: it specifies font color.eg.<font color=red>
5. Size: it specifies font size. Eg.<font size=4>

Q15:- Difference between <basefont> and <font>.


Ans:-the <BASEFONT> tag takes the same attributes as <FONT> but affects all the text that follows it until a
new tag affecting that is encounted. Thus, it should be used default setting of the text.
<FONT> only affects text upto closing i.e </FONT>

Q16:- Define <hr> tag with its attribute. Or Define Horizontal line tag with its attribute.
ans:- The <hr> tag produces a horizontal line spread across the width of the browser window. It is empty tag. Its
attributes are size, width, noshade, color.
Attribute
1. SIZE:- it defines thickness of horizontal line. Default size of horizontal rule is 3 pixels. The size
attribute of <HR> is given values in terms of pixels. 72 pixel= 1 inch.
2. Width:- It defines the length of the horizontal line. It can be given in terms of pixels and percentage of
the browser window.
Eg <HR SIZE=72 WIDTH=50%>
3. NOSHADE:- It draws a 2D or flat rule.eg <HR SIZE=72 WIDTH=50% noshade>
4. COLOR:- It gives colour to the rule. <HR SIZE=72 WIDTH=50% color=red noshade>

17Q:- Define <comment> tag.


Ans:- Comments are one type of textual content which appear in HTML code, but are not rendered by user’s
browser. Comments are given between special <!-- and -- >markup elements.
Eg. <!- -This is a comment -- >

Q18:- Define Logical and Physical text styles.


Ans:- Html has 2 types of styles for individual words or sentences :
1. Logical text Style
2. Physical text Style
1. Logical text style: it is general descriptions. Each browser handles a logical style in its own way.
Logical styles render the text according to its meaning e.g., <EM> is for emphasizing something.
Various Logical styles are:
<DFN> : For a word being defined. Typically displayed in italics.
<EM>: For emphasis. Typically displayed in italics.
<CITE>: For titles of books, films etc. Typically displayed in italics.
<CODE>: For computer code. Displayed in a fixed width font.
<KBD>: For user keyboard entry. Displayed in fixed width font.
<SAMP>: For a sequence of literal characters. Displayed in fixed width font.
<STRONG>: For strong emphasis. Displayed in bold.
<VAR>: for a variable, where you will replace the variable with specific information. Displayed in
italics.

2. Physical Text style:- it indicate the specific type of appearance for a section e.g. bold, italic etc.
Physical text style is rendered in the same manner by all browser.
Various physical text styles are:
<B>: bold text
<I> : italic text
<U> : underlined text
<TT>: typewriter text
Example:
<html>
<body>
<b> example of bold text </b>
<i> example of italic text </i>
<u> example of underlined text </u>
</body>
</html>
19Q:-Define subscript and superscript.
Ans:- to write something like H2O, you can write it as H <SUB> 2 </SUB> O. Similarly to write
something like X2, you can write it as X <SUP> 2 </SUP>.

Q20:- How can you write special characters like <,>,& in a web page?
Ans:-these special characters have special meaning in HTML and so cannot be used in HTML as text.
To use one of the three characters in HTML document, type in the following way
&LT : will display <
&RT : will display >
&amp : will display &
example
<html>
<body>
&LT MR. &RT
</body>
</html>
Browser window displays as:
< MR >

Q21:- Is it possible to Combinig tags.


Ans:- yes, eg.
<H1> <font color = blue > heading 1 <H1> </FONT>

Q22:- Define Lists in HTML.


Ans:- There are 3 basic types of lists in HTML:
1. Ordered/numbered list <OL>
2. Unordered / unnumbered list <UL>
3. Definition List <DL>
Ordered/numbered list <OL>: This lists have numbers and letters in front of each item. it has type,
start attribute. To make a numbered list
1. start with an opening list <OL> tag.
2. Enter the <LI> tag followed by individual item; off tag is not required. It is optional.
1. 3. End the entire list with a closing list </OL> tag.
<OL>
<LI> ORANGES
<LI> PREACHES
<LI> GRAPES
</OL>

Type attribute: you can use this attribute with the <ol> to change the numbering style itself. With the
<ol> tag, then type attribute may have a value of A for numbering with capital letters , a for numbering
with lowercase letters, I for capital Roman numbers, i for lowercase Roman numerals, or 1 for common
Arabic numerals. The default list is Arabic numerals 1,2,3 etc.
Start attribute: The start attribute for the <OL> tag lets you change that beginning value. To start a list
at 5, eg.
<OL start=5 type=a>
<LI> ONE
<LI> TWO
</OL>
OUTPUT
e. ONE
f. two
2. unordered list:- This is bulleted lists. These lists are marked by <UL> and </UL> tags. To make a
bulleted list
1. start with an opening list <UL> tag.
2. Enter the <LI> tag followed by individual item; off tag is not required. It is optional.
3. End the entire list with a closing list </UL> tag.
Eg.
<UL>
<LI> ONE
<LI> TWO
</UL>
• ONE
• TWO
Type attribute:- by default, a solid circle is used for the bullets. However, yoy can change the bullet style
using type attribute. This attribute may have a value either disc, circle, or square eg.,<UL type= square>. The
disc is the default bullet i.e, a solid circle. Attribute value circle displays a solid square as the bullet. Eg
<html>
<body>
<UL>
<LI> ONE
<LI> TWO
</UL>
<UL type=circle>
<LI> ONE
<LI> TWO
</UL>
<UL type=square>
<LI> ONE
<LI> TWO
</UL>
</body>
</html>

• One
• Two
o One
o Two
 One
 two

2. Definition lists:- it is indented list without any bullet symbol or any number in front of each item. A
definition list <DL> usually consists of alternating a definition term <DT> and a definition description.
Web browsers generally format the definition on a new line and indent it.eg.
<DL>
<DT> html
<DD> hypertext markup languge
<DT> http
<DD> hypertext transfer protocol
</DT>
Compact attribute: it can be used incase your definition are very short. This option may fit on the
same line as the start of the definition.
<DL>
<DT compact> html
<DD> hypertext markup languge
<DT> http
<DD> hypertext transfer protocol
</DT>

You might also like