0% found this document useful (0 votes)
4 views26 pages

HTML

The document provides a comprehensive guide to basic HTML structure, including essential tags, elements, and formatting techniques. It covers topics such as creating lists, hyperlinks, images, tables, and the differences between block and inline elements. Additionally, it includes practical coding scenarios and examples for better understanding of HTML concepts.

Uploaded by

mahbub sourov
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views26 pages

HTML

The document provides a comprehensive guide to basic HTML structure, including essential tags, elements, and formatting techniques. It covers topics such as creating lists, hyperlinks, images, tables, and the differences between block and inline elements. Additionally, it includes practical coding scenarios and examples for better understanding of HTML concepts.

Uploaded by

mahbub sourov
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

🌐 1️⃣ Basic HTML Structure (VERY IMPORTANT)

Every HTML page must have this structure:

<html>
<head>
<title>My Page</title>
</head>
<body>
Hello World
</body>
</html>

🔎 Explanation

 <html> → Start of HTML

 <head> → Page information

 <title> → Browser tab name

 <body> → Visible content

🖥 Output

Browser tab shows: My Page


Page shows:
Hello World

🌐 2️⃣ Comments in HTML

<!-- This is a comment -->


<p>Hello</p>

🔎 Explanation
 Comment is not shown in browser

 Used for explanation

🖥 Output

Hello

🌐 3️⃣ Tags vs Elements (Short Theory)

 Tag → <p>

 Element → <p>Hello</p>

👉 Element = Opening tag + content + closing tag

🌐 4️⃣ Paragraph & Line Break

<p>This is first line</p>


<p>This is second line</p>

🖥 Output

This is first line


(blank space)
This is second line

Line Break <br>

This is first line <br>


This is second line
🖥 Output

This is first line


This is second line

🌐 5️⃣ Headings (Very Common)

<h1>Main Heading</h1>
<h2>Sub Heading</h2>
<h3>Small Heading</h3>

🖥 Output

Large bold heading


Medium heading
Small heading

👉 h1 biggest, h6 smallest

🌐 6️⃣ Horizontal Line

<h1>Title</h1>
<hr>
<p>Paragraph</p>

🖥 Output

Title

Paragraph
🌐 7️⃣ Text Formatting (Exam Important)

<p>This is <b>bold</b></p>
<p>This is <i>italic</i></p>
<p>This is <strong>important</strong></p>
<p>H<sub>2</sub>O</p>
<p>10<sup>2</sup></p>

🖥 Output

This is bold
This is italic
This is important
H₂O
10²

🌐 8️⃣ Ordered List (Numbered)

<ol>
<li>Apple</li>
<li>Banana</li>
<li>Mango</li>
</ol>

🖥 Output

1. Apple

2. Banana

3. Mango
🌐 9️⃣ Unordered List (Bullet)

<ul>
<li>Red</li>
<li>Green</li>
<li>Blue</li>
</ul>

🖥 Output

• Red
• Green
• Blue

🌐 🔟 Hyperlink (VERY IMPORTANT)

<a href="[Link] to Google</a>

🖥 Output

Clickable text → Go to Google


Click করলে Google open হবে

Open in New Tab

<a href="[Link] target="_blank">


Open Google
</a>
🌐 1️⃣1️⃣ Image

<img src="[Link]" alt="My Image">

🔎 Explanation

 src → image file name

 alt → text if image not found

🖥 Output

Image shows (if file exists)

🌐 1️⃣2️⃣ Table (🔥 MOST IMPORTANT)

Basic Table

<table border="1">
<tr>
<th>Name</th>
<th>Age</th>
</tr>
<tr>
<td>Rahim</td>
<td>20</td>
</tr>
</table>

🖥 Output

Name Age

Rahim 20
Rowspan Example

<table border="1">
<tr>
<td rowspan="2">A</td>
<td>B</td>
</tr>
<tr>
<td>C</td>
</tr>
</table>

🖥 Output

|A|B|
||C|

👉 A covers 2 rows

Colspan Example

<table border="1">
<tr>
<td colspan="2">Total</td>
</tr>
</table>

🖥 Output

| Total (covers 2 columns) |


🌐 1️⃣3️⃣ Div vs Span (Theory Question)

Div

<div>This is div</div>

 Block element

 Takes full width

 New line

Span

<span>This is span</span>

 Inline element

 No new line

✅ Question 1

✍ Write the basic structure of an HTML document.

✔ Answer Code:

<html>
<head>
<title>My Web Page</title>
</head>
<body>
<h1>Welcome</h1>
<p>This is my page.</p>
</body>
</html>

🖥 Output:

Browser tab → My Web Page


Page shows:

Welcome
This is my page.

👉 Very common theory + short coding question

✅ Question 2

✍ Create an ordered list of 3 subjects.

✔ Answer Code:

<ol>
<li>Math</li>
<li>English</li>
<li>ICT</li>
</ol>

🖥 Output:

1. Math
2. English

3. ICT

👉 Sometimes they ask difference between OL and UL

✅ Question 3

✍ Create a hyperlink that opens Google in new tab.

✔ Answer Code:

<a href="[Link] target="_blank">


Visit Google
</a>

🖥 Output:

Clickable text → Visit Google


Click করলে Google new tab এ open হবে

👉 target="_blank" খুব important

✅ Question 4 🔥 (Very Important)

✍ Create a table with Name and Age.

✔ Answer Code:

<table border="1">
<tr>
<th>Name</th>
<th>Age</th>
</tr>
<tr>
<td>Rahim</td>
<td>20</td>
</tr>
<tr>
<td>Karim</td>
<td>22</td>
</tr>
</table>

🖥 Output:

Name Age

Rahim 20

Karim 22

🔥 Table question almost always comes

✅ Question 5 🔥

✍ Create a table using colspan.

✔ Answer Code:

<table border="1">
<tr>
<th colspan="2">Student Info</th>
</tr>
<tr>
<td>Name</td>
<td>Rahim</td>
</tr>
</table>

🖥 Output:

Student Info

Name

👉 colspan = merge columns

✅ Question 6 🔥

✍ Create a table using rowspan.

✔ Answer Code:

<table border="1">
<tr>
<td rowspan="2">A</td>
<td>B</td>
</tr>
<tr>
<td>C</td>
</tr>
</table>

🖥 Output:

|A|B|
||C|

👉 rowspan = merge rows


✅ Question 7

✍ Show text formatting (bold, italic, subscript, superscript).

✔ Answer Code:

<p>This is <b>bold</b></p>
<p>This is <i>italic</i></p>
<p>H<sub>2</sub>O</p>
<p>10<sup>2</sup></p>

🖥 Output:

This is bold
This is italic
H₂O
10²

✅ What is a Tag?

👉 Tag is a keyword written inside angle brackets < > used to create HTML elements.

Example of a tag:

<p>

Most tags have:


 Opening tag → <p>

 Closing tag → </p>

Example of full element:

<p>Hello</p>

👉 Tag creates structure of web page.

✅ Types of Tags

1️⃣ Container Tag (Has closing tag)

Example:

<p>Hello</p>

2️⃣ Empty Tag (No closing tag)

Example:

<br>
<hr>
<img>

✅ Important Tags You Must Learn For Exam

Only these 👇 (No extra)

1️⃣ Basic Structure Tags


Tag Work

<html> Start HTML

<head> Page info

<title> Browser title

<body> Visible content

Example:

<html>
<head>
<title>My Page</title>
</head>
<body>
Hello
</body>
</html>

🖥 Output → Shows "Hello"

2️⃣ Text Tags

Tag Work

<p> Paragraph

<br> Line break

<h1> – <h3> Headings

<hr> Horizontal line


Tag Work

Example:

<h1>Title</h1>
<p>This is paragraph</p>
<hr>
Second line <br>
Third line

3️⃣ Formatting Tags

Tag Work

<b> Bold

<i> Italic

<strong> Important text

<sub> Subscript

<sup> Superscript

Example:

<p>This is <b>bold</b></p>
<p>H<sub>2</sub>O</p>
<p>10<sup>2</sup></p>

🖥 Output:
Bold text
H₂O
10²

4️⃣ List Tags

Tag Work

<ol> Ordered list

<ul> Unordered list

<li> List item

Example:

<ol>
<li>HTML</li>
<li>CSS</li>
</ol>

5️⃣ Link Tag

Tag Work

<a> Hyperlink

Example:

<a href="[Link]
Visit Google
</a>
6️⃣ Image Tag

Tag Work

<img> Show image

Example:

<img src="[Link]" alt="My Photo" width="200">

7️⃣ Table Tags (🔥 Most Important)

Tag Work

<table> Create table

<tr> Table row

<td> Table data

<th> Table heading

Example:

<table border="1">
<tr>
<th>Name</th>
<th>Age</th>
</tr>
<tr>
<td>Rahim</td>
<td>20</td>
</tr>
</table>
8️⃣ Layout Tags

Tag Work

<div> Block container

<span> Inline container

Example:

<div>This is div</div>
<span>This is span</span>

✅ Scenario 1 🔥 (Very Common)

✍ Scenario:

Create a web page that shows:

 A main heading "Student Information"

 A paragraph

 A horizontal line

✔ Answer Code:
<html>
<head>
<title>Student Page</title>
</head>
<body>

<h1>Student Information</h1>
<p>This page contains student details.</p>
<hr>

</body>
</html>

🖥 Output:

Big heading → Student Information


Paragraph text
A horizontal line

✅ Scenario 2 🔥 (List + Formatting)

✍ Scenario:

Create a webpage that shows:

 Bold title "Subjects"

 An ordered list of 3 subjects

✔ Answer Code:
<html>
<body>

<b>Subjects</b>

<ol>
<li>Math</li>
<li>English</li>
<li>ICT</li>
</ol>

</body>
</html>

🖥 Output:

Subjects (bold)

1. Math

2. English

3. ICT

✅ Scenario 3 🔥 (Hyperlink + Image)

✍ Scenario:

Create a webpage that:

 Shows an image

 When user clicks a link, Google opens in new tab


✔ Answer Code:

<html>
<body>

<img src="[Link]" width="200">

<br><br>

<a href="[Link] target="_blank">


Open Google
</a>

</body>
</html>

🖥 Output:

Image displayed
Clickable link → Opens Google in new tab

✅ Scenario 4 🔥🔥 (Most Important – Table)

✍ Scenario:

Create a table that shows student name and marks.

✔ Answer Code:
<html>
<body>

<table border="1">
<tr>
<th>Name</th>
<th>Marks</th>
</tr>
<tr>
<td>Rahim</td>
<td>80</td>
</tr>
<tr>
<td>Karim</td>
<td>85</td>
</tr>
</table>

</body>
</html>

🖥 Output:

Name Marks

Rahim 80

Karim 85

🔥 Table question almost always comes

✅ Scenario 5 🔥 (Colspan)
✍ Scenario:

Create a table where "Result" covers 2 columns.

✔ Answer Code:

<html>
<body>

<table border="1">
<tr>
<th colspan="2">Result</th>
</tr>
<tr>
<td>Name</td>
<td>Rahim</td>
</tr>
</table>

</body>
</html>

🖥 Output:

Result

Name

👉 colspan merges columns

✅ Scenario 6 🔥 (Rowspan)
✍ Scenario:

Create a table where first column covers 2 rows.

✔ Answer Code:

<html>
<body>

<table border="1">
<tr>
<td rowspan="2">A</td>
<td>B</td>
</tr>
<tr>
<td>C</td>
</tr>
</table>

</body>
</html>

🖥 Output:

|A|B|
||C|

👉 rowspan merges rows

✅ Scenario 7 (Div vs Span)


✍ Scenario:

Show difference between div and span.

✔ Answer Code:

<html>
<body>

<div>This is div</div>
<span>This is span</span>

</body>
</html>

🖥 Output:

Div → new line


Span → same line

You might also like