DAV / CBSE Computer Subject - Beginner Learning Material
HTML stands for HyperText Markup Language.
HTML is used to create the structure of web pages. It tells a web browser what content should appear on a webpage.
<html>
<body>
<h1>Welcome to My Web Page</h1>
<p>This is my first HTML page.</p>
</body>
</html>
The browser reads the HTML code and displays the webpage.
A basic HTML document normally contains the following important parts:
<!DOCTYPE html>
<html>
<head>
<title>My Web Page</title>
</head>
<body>
<h1>Hello!</h1>
<p>Welcome to HTML.</p>
</body>
</html>
| Tag | Purpose |
|---|---|
<!DOCTYPE html> |
Tells the browser that the document is HTML5. |
<html> |
Root element of the HTML document. |
<head> |
Contains information about the webpage. |
<title> |
Displays the title on the browser tab. |
<body> |
Contains the visible content of the webpage. |
HTML provides six levels of headings, from
<h1> to <h6>.
<h1>My School</h1>
<h2>My Class</h2>
<h3>My Subjects</h3>
<h4>Mathematics</h4>
<h5>Chapter 1</h5>
<h6>Exercise</h6>
<h1> is normally the main/largest heading,
while <h6> is the smallest heading.
The <p> tag is used to create a paragraph.
<p>
My name is Rahul.
I study in Class 8.
I like learning computers.
</p>
The <br> tag is used to move text to the
next line.
My name is Rahul.<br>
I study in Class 8.<br>
I like computers.
My name is Rahul.
I study in Class 8.
I like computers.
<br> tag does not normally require
a closing tag.
<b>Computer</b>
Output: Computer
<i>Computer</i>
Output: Computer
<u>Computer</u>
Output: Computer
<b><i>HTML</i></b>
Output: HTML
Lists are used to display a group of related items.
An ordered list displays items using numbers.
<ol>
<li>English</li>
<li>Mathematics</li>
<li>Science</li>
<li>Computer</li>
</ol>
An unordered list displays items using bullets.
<ul>
<li>Apple</li>
<li>Mango</li>
<li>Banana</li>
</ul>
The <img> tag is used to display an image
on a webpage.
<img src="school.jpg" alt="My School">
| Attribute | Purpose |
|---|---|
src |
Specifies the image location. |
alt |
Provides alternative text for the image. |
width |
Specifies image width. |
height |
Specifies image height. |
<img src="school.jpg"
width="300"
height="200"
alt="My School">
The <a> tag is used to create a hyperlink.
<a href="https://www.google.com">
Visit Google
</a>
When the user clicks the link, the browser opens the website.
href specifies the destination of the link.
Attributes provide additional information about an HTML element.
<img src="flower.jpg" width="200">
Here src and width are attributes.
<a href="https://www.google.com">
Google
</a>
Here href is an attribute.
Tables are used to display information in rows and columns.
<table border="1">
<tr>
<th>Name</th>
<th>Class</th>
<th>Marks</th>
</tr>
<tr>
<td>Rahul</td>
<td>8</td>
<td>85</td>
</tr>
<tr>
<td>Anita</td>
<td>8</td>
<td>92</td>
</tr>
</table>
| Tag | Meaning |
|---|---|
<table> |
Creates a table. |
<tr> |
Creates a table row. |
<th> |
Creates a table heading. |
<td> |
Creates table data. |
Comments are notes written inside HTML code. They are not displayed on the webpage.
<!-- This is my first HTML program -->
<h1>My School</h1>
Comments are useful for explaining the code.
A basic school-level example of changing the background is:
<body bgcolor="lightblue">
<h1>Hello Students</h1>
<p>This is my webpage.</p>
</body>
bgcolor.
This program combines several HTML concepts learned so far.
<!DOCTYPE html>
<html>
<head>
<title>My School</title>
</head>
<body>
<h1>My School</h1>
<p>
My school is DAV Public School.
I study in Class 8.
</p>
<h2>My Favourite Subjects</h2>
<ol>
<li>Mathematics</li>
<li>Science</li>
<li>Computer</li>
<li>English</li>
</ol>
<h2>My Hobbies</h2>
<ul>
<li>Reading</li>
<li>Playing Cricket</li>
<li>Drawing</li>
</ul>
</body>
</html>
Open Notepad on your computer.
<html>
<body>
<h1>My First Website</h1>
<p>Hello! I am learning HTML.</p>
</body>
</html>
Save the file with the name:
index.html
When saving from Notepad, select Save as type: All Files.
Double-click the index.html file.
It will open in a web browser such as Chrome or Edge.
| Day | Topic |
|---|---|
| Day 1 | What is HTML and basic structure |
| Day 2 | HTML tags, headings and paragraphs |
| Day 3 | Bold, italic, underline and line break |
| Day 4 | Ordered and unordered lists |
| Day 5 | Images |
| Day 6 | Hyperlinks |
| Day 7 | Tables |
| Day 8 | HTML attributes |
| Day 9 | HTML comments and basic styling |
| Day 10 | Build a complete webpage |
Create a webpage about yourself using the HTML concepts you have learned.
<!DOCTYPE html>
<html>
<head>
<title>My Profile</title>
</head>
<body>
<h1>My Profile</h1>
<h2>About Me</h2>
<p>
My name is __________.
I study in Class 8.
</p>
<h2>My Favourite Subjects</h2>
<ul>
<li>Mathematics</li>
<li>Science</li>
<li>Computer</li>
</ul>
<h2>My Hobbies</h2>
<ol>
<li>Reading</li>
<li>Cricket</li>
<li>Drawing</li>
</ol>
</body>
</html>
| Tag | Purpose |
|---|---|
<html> |
HTML document |
<head> |
Document information |
<title> |
Browser tab title |
<body> |
Visible webpage content |
<h1> - <h6> |
Headings |
<p> |
Paragraph |
<br> |
Line break |
<b> |
Bold text |
<i> |
Italic text |
<u> |
Underlined text |
<ol> |
Ordered list |
<ul> |
Unordered list |
<li> |
List item |
<img> |
Image |
<a> |
Hyperlink |
<table> |
Table |
<tr> |
Table row |
<th> |
Table heading |
<td> |
Table data |
<!-- --> |
Comment |