You are on page 1of 2

CHAPTER-2 (HTML)

1. What is HTML?
Answer: HTML stands for Hypertext Markup Language. It is a layout and format defining language used
to write Web pages. It allows you to:

1.

Publish documents to the Internet in a platform independent format

2.

Create links to related work from your document

3.

Include graphics and multimedia data in your documents

4.

Link to non-World Wide Web information resources on the Internet

2. Brief about HTML tags and Elements.


Answer: An HTML tag defines the markup for a particular content in an HTML page and is represented
within angular brackets. A start tag is represented as <tag_name> and an end tag is represented as
</tag_name>. Most tags in HTML are in pairs of start and end tag. Only some tags such as <br> do not
have an end tag.
An element contains a start tag, an end tag, and the content, which is marked up by those tags. The content
in an element may comprise of data as well as nested tags. For example, the following is an HTML
element:
<body>
<p>This is a nested tag</p>
</body>
An HTML page starts and end with <HTML></HTML> tags, marking the beginning and end of an HTML
page. A page can be divided into the header and the body. The <HEAD></HEAD> tags represent the
former and contain header information, which is not displayed in the browser window. The
<HEAD></HEAD> tags also contain the <TITLE></TITLE> tags, which contain the text that will be
displayed in the title bar of the browser window when the page is opened.
The <BODY></BODY> tags comprise the body element of an HTML page. The content with the
<BODY></BODY> tags is displayed in the browser window.
3. List down different classifications of tags with 2 examples tags for each category.
Answer: Tags can be classified as:

Tags for document structure: HTML and HEAD

Heading tags: TITLE and LINK

Block-level text elements: H1 through H6, P

Lists: OL and UL

4. Explain any 4 HTML tags with at least 4 attributes with example.


Answer: The <BODY> tag represents the body of an HTML page and contains the content to be displayed
in the browser window. It has various attributes including:

A)BACKGROUND: Specifies an image to be displayed in the background of an HTML page. Its value can
be an absolute URL or a relative URL.
B)BGCOLOR: Sets the color of the backgroud
C)TEXT: Sets the default color of normal text for the HTML page.
D)LINK: Sets the default color of unvisited links in an HTML page.
The <TABLE> tag is used to create tables in HTML pages. It has various attributes such as:
E)BORDER: Indicates the thickness, in pixels, of the border to be drawn around the table.
F)CELLPADDING: Determines the amount of space, in pixels, between individual cells in a table.
G) CEPPSPACING: Determines the amount of space, in pixels, between individual cells in a table.
H) WIDTH: Determines the width of the table.
The <IMG> tag inserts images in an HTML page. It has various attributes such as:
I) SRC: Path of the image to be displayed.
J) ALT: Alternative text to be displayed in case the image cannot be displayed.
K) LOWSRC: Path of a low resolution version of the image.
L) HEIGHT and WIDTH: Specifies the dimensions of the image.
The <HR> tag is used to draw a horizontal line in HTML pages. It has various attributes such as:
M) ALIGN: Specifies the horizontal alignment of the lines that do not span the whole page.
N) NOSHADE: Reproduces a solid black line that has no shading.
O) SIZE: Indicates the thickness of the line in pixels.
P )WIDTH: Defines the horizontal width of the line.
5. Write an example HTML page containing a table 4 X 3 and each row colored differently.
Answer: The following is an HTML page containing a table 4 X 3 and each row colored differently:
<html>
<head>
<title>Colored Table</title>
</head>
<body>
<table border="1" width="100%">
<tr bgcolor="#0000FF">
<td width="33%">&nbsp;</td>
<td width="33%">&nbsp;</td>
<td width="34%">&nbsp;</td>
</tr>
<tr bgcolor="#00A0FF">
<td width="33%">&nbsp;</td>
<td width="33%">&nbsp;</td>
<td width="34%">&nbsp;</td>
</tr>
<tr bgcolor="#AB00FF">
<td width="33%">&nbsp;</td>
<td width="33%">&nbsp;</td>
<td width="34%">&nbsp;</td>
</tr>
<tr bgcolor="#FB2CFF">
<td width="33%">&nbsp;</td>
<td width="33%">&nbsp;</td>
<td width="34%">&nbsp;</td>
</tr>
</table>
</body>
</html>

You might also like