HTML PDF Class 10th
HTML PDF Class 10th
1. History of HTML
HTML (HyperText Markup Language) is the standard language for creating web pages.
Developed by Tim Berners-Lee in 1991.
2. Tags
Tags are keywords enclosed in angle brackets < >.
Most tags come in pairs: opening tag <tagname> and closing tag </tagname>.
Some tags are self-closing: <br>, <hr>, <img>.
Tags define the structure and formatting of web content.
3. Elements
An element consists of:
Opening tag , Content ,Closing tag
Example:
<p>This is a paragraph.</p>
Elements can be nested inside other elements.
4. Attributes
Attributes provide additional information about elements.
Placed inside the opening tag.
Written as name="value".
Example:
<img src="image.jpg" alt="Description">
5. Common HTML Container Elements
Container elements hold other elements.
Examples:
<body>: Contains all visible content.
<table>: Contains tabular data.
6. <p> Tag
Used to define a paragraph.
Syntax: <p>Paragraph text here.</p>
Browsers add space before and after paragraphs.
7. <center> Tag
Used to center-align text or content.
Syntax: <center>Centered content</center>
8. Comment Tag
Used to add comments in HTML code.
Comments are not displayed in the browser.
Syntax: <!-- This is a comment -->
9. <font> Tag
Used to change font style, size, and color.
Syntax: <font color="red" size="4" face="Arial">Text</font>
10. <basefont> Tag
Sets a default font size, color, and face for the page.
Syntax: <basefont size="4" color="blue" face="Verdana">
11. <body> Tag and Its Attributes
Represents the main content of an HTML document.
All visible elements are placed inside <body> ... </body>.
Common attributes:
Attribute Description
bgcolor Sets background color (<body bgcolor="yellow">)
background Sets background image (<body background="bg.jpg">)
text Sets text color (<body text="black">)
link Sets color of hyperlinks (<body link="blue">)
alink Sets color of active link (<body alink="red">)
vlink Sets color of visited link (<body vlink="purple">)
12. <br> Tag
Inserts a line break.
Syntax: <br>
Self-closing; does not need a closing tag.
13. <hr> Tag
Inserts a horizontal rule (line).
Syntax: <hr>
Used to separate content sections.
Self-closing; can use attributes like width, size, color (deprecated), e.g. <hr width="50%"
size="3" color="red">.
14. HTML Lists
a. Ordered List (<ol>)
Displays items in a numbered sequence.
Syntax:
<ol>
<li>First item</li>
<li>Second item</li>
</ol>
List type can be changed using type attribute (1, A, a, I, i).
b. Unordered List (<ul>)
Displays items with bullets.
Syntax:
<ul>
<li>Item one</li>
<li>Item two</li></ul>
Bullet style can be changed using type attribute (disc, circle, square).
c. Definition List (<dl>)
Used for terms and definitions.
Syntax:
<dl>
<dt>Term</dt>
<dd>Definition of the term.</dd>
</dl>
Tip:
Most presentational tags like <center>, <font>, <basefont>, and attributes like bgcolor,
text, etc., are deprecated in HTML5. Prefer using CSS for styling and layout.
PAST CBSE QUESTIONS
1. What is HTML? What is the purpose of using it?
HTML (HyperText Markup Language) is the standard language used to create and
design web pages. It structures web content using elements and tags, allowing
browsers to display text, images, links, and multimedia on the internet.
2. Write the extension of an HTML code file.
The extension of an HTML file is .html or .htm.
3. How many types of tags are there in HTML? Name them with examples.
There are two main types of tags in HTML:
Container Tags: Have both opening and closing tags.
Example: <p>Paragraph</p>
Empty Tags (Self-closing Tags): Do not have a closing tag.
Example: <br>, <hr>, <img>
4. Explain the basic structure of an HTML document with a suitable example.
The basic structure of an HTML document:
<html>
<head>
<title>Page Title</title>
</head>
<body>
Content goes here.
</body>
</html>
5. What is the difference between container tags and empty tags in HTML? Give
examples.
Container Tags: Enclose content and have both opening and closing tags.
Example: <b>Bold Text</b>
Empty Tags: Do not enclose content and do not have a closing tag.
Example: <br>, <hr>
6. What are attributes in HTML? Explain with an example.
Attributes provide additional information about HTML elements. They are written inside
the opening tag.
Example:
<img src="logo.png" alt="Website Logo">
Here, src and alt are attributes of the <img> tag.
7. What is the use of the <body> tag? List any four attributes of the <body> tag
and explain their purpose.
The <body> tag contains all the visible content of a web page.
Four attributes:
Attribute Purpose
bgcolor Sets background color (e.g., <body bgcolor="yellow">)
background Sets background image (e.g., <body background="bg.jpg">)
text Sets text color (e.g., <body text="black">)
link Sets color of hyperlinks (e.g., <body link="blue">)
8. What is the function of the <p> tag? Write HTML code to display two
paragraphs on a web page.
The <p> tag defines a paragraph.
Example:
<p>This is the first paragraph.</p>
<p>This is the second paragraph.</p>
9. What is the <center> tag used for? Is it recommended in modern HTML? Why
or why not?
The <center> tag is used to center-align text or content.
Not recommended in modern HTML because it is deprecated in HTML5. Instead, use
CSS:
<div style="text-align: center;">Centered Content</div>
10. How do you add comments in HTML? Write the syntax and give an example.
Comments are added using <!-- comment --> and are not displayed in the browser.
Example:
<!-- This is a comment -->
11. Write HTML code to display a horizontal line of red color on a web page.
<hr color="red">
12. Write HTML code to create an ordered list of any three fruits, starting from the
letter ‘C’.
<ol>
<li>Cherry</li>
<li>Cantaloupe</li>
<li>Coconut</li>
</ol>
13. Write HTML code to create an unordered list with different bullet styles.
<ul type="disc">
<li>First item (disc)</li>
</ul>
<ul type="circle">
<li>Second item (circle)</li>
</ul>
<ul type="square">
<li>Third item (square)</li>
</ul>
14. Write HTML code to create a definition list for any two computer terms.
<dl>
<dt>HTML</dt>
<dd>HyperText Markup Language</dd>
<dt>CPU</dt>
<dd>Central Processing Unit</dd>
</dl>
15. Write HTML code to display the text “Welcome to My Webpage” in blue color
and font size 5 using the <font> tag.
<font color="blue" size="5">Welcome to My Webpage</font>