ICT HSC Chapter4 Study Guide
ICT HSC Chapter4 Study Guide
A step-by-step guide through HTML tags for the HSC exam. Every topic has the
problem, what the output looks like, how to think about it, and the solution code.
All examples are complete HTML documents. Just copy and save as .html , then
open in a browser.
Problem
Create a webpage with the title "My First Page" and show "Hello World!" in the body.
How to think
Step 1: Every HTML page has <html> at the top and </html> at the bottom.
Step 2: Inside <html> , there are two parts: <head> and <body> .
Step 3: The <head> holds the <title> . The <body> holds what you see on the
page.
Solution
<html>
<head>
<title>My First Page</title>
</head>
<body>
Hello World!
</body>
</html>
Problem
Create a webpage with a yellow background, blue text, and the title "Colors".
How to think
Step 1: The <body> tag has attributes. An attribute goes inside the opening tag.
Step 2: bgcolor="yellow" makes the background yellow.
Solution
<html>
<head>
<title>Colors</title>
</head>
<body bgcolor="yellow" text="blue">
This is my colored page
</body>
</html>
Problem
Create a page with background image [Link] , normal link color green, visited link
color red, active link color blue.
How to think
Step 2: link sets color of unvisited links. vlink sets visited link color. alink sets
color when clicking.
Step 3: You need a link to see the colors work. Use <a href="[Link]">Click</a> .
Solution
<html>
<head>
<title>Background and Links</title>
</head>
<body background="[Link]" link="green" vlink="red" alink="blue">
<a href="[Link]">Click here</a>
</body>
</html>
Topic 2: Text Formatting
Exercise 1: Headings
Problem
Step 2: Each heading automatically puts a new line before and after.
Solution
<html>
<head>
<title>Headings</title>
</head>
<body>
<h1>This is Heading 1</h1>
<h2>This is Heading 2</h2>
<h3>This is Heading 3</h3>
<h4>This is Heading 4</h4>
<h5>This is Heading 5</h5>
<h6>This is Heading 6</h6>
</body>
</html>
Problem
Show one line in bold, one in italic, one underlined, and one with all three.
This is bold
This is italic
This is underlined
This is bold italic and underlined
How to think
Step 1: Wrap the text in <b> for bold, <i> for italic, <u> for underline.
Step 2: You can put tags inside tags (nesting). <b><i><u>text</u></i></b> does all
three.
Solution
<html>
<head>
<title>Bold Italic Underline</title>
</head>
<body>
<b>This is bold</b><br>
<i>This is italic</i><br>
<u>This is underlined</u><br>
<b><i><u>This is bold italic and underlined</u></i></b>
</body>
</html>
Problem
Show two paragraphs separated by a line, and a poem with line breaks.
----------------------------------------------------------------
How to think
Step 1: <p> adds space before and after. Use it for paragraphs.
Step 2: <br> just goes to the next line without extra space. Use it inside a
paragraph.
Solution
<html>
<head>
<title>Paragraph and Breaks</title>
</head>
<body>
<p>This is the first paragraph. It has multiple sentences.</p>
<hr>
<p>This is the second paragraph.</p>
Now a poem:<br>
Roses are red<br>
Violets are blue
</body>
</html>
Problem
Show the same word "Hello" in three different styles: big red Arial, medium green
Times New Roman, small blue Courier New.
How to think
Solution
<html>
<head>
<title>Font Tag</title>
</head>
<body>
<font face="Arial" size="7" color="red">Hello</font><br>
<font face="Times New Roman" size="5" color="green">Hello</font><br>
<font face="Courier New" size="2" color="blue">Hello</font>
</body>
</html>
Problem
Show the chemical formula H2O (with 2 as subscript) and the mathematical
expression X2+Y2 (with 2 as superscript).
What it looks like
How to think
Step 1: <sub> makes text smaller and below the normal line. Use it for chemical
formulas.
Step 2: <sup> makes text smaller and above the normal line. Use it for powers/
exponents.
Solution
<html>
<head>
<title>Subscript and Superscript</title>
</head>
<body>
H<sub>2</sub>O<br>
X<sup>2</sup> + Y<sup>2</sup>
</body>
</html>
Problem
NOTICE
________________________________________
How to think
Step 3: Wrap the paragraph text in <b> and <font color="red"> at the same time.
Solution
<html>
<head>
<title>Notice</title>
</head>
<body>
<h1 align="center">NOTICE</h1>
<hr>
<p><b><font color="red">This is a bold red notice text.</font></b></p>
</body>
</html>
Topic 3: Lists
Type values for <ol> : - type="1" — numbers (1, 2, 3...) (default) - type="A" —
capital letters (A, B, C...) - type="a" — small letters (a, b, c...) - type="I" — Roman
numbers (I, II, III...) - type="i" — small Roman (i, ii, iii...)
Problem
Create three unordered lists using disc, circle, and square. Each list has three items:
Apple, Banana, Cherry.
How to think
Solution
<html>
<head>
<title>Unordered List</title>
</head>
<body>
Fruits with disc:
<ul type="disc">
<li>Apple</li>
<li>Banana</li>
<li>Cherry</li>
</ul>
Problem
Create four ordered lists: with numbers (1, 2, 3), capital letters (A, B, C), small letters
(a, b, c), and Roman numerals (I, II, III).
Numbers:
1. First
2. Second
3. Third
Letters:
A. First
B. Second
C. Third
Small letters:
a. First
b. Second
c. Third
Roman:
I. First
II. Second
III. Third
How to think
Step 2: type="A" gives capital letters, type="a" gives small letters, type="I" gives
Roman.
Solution
<html>
<head>
<title>Ordered List</title>
</head>
<body>
Numbers:
<ol type="1">
<li>First</li>
<li>Second</li>
<li>Third</li>
</ol>
Letters:
<ol type="A">
<li>First</li>
<li>Second</li>
<li>Third</li>
</ol>
Small letters:
<ol type="a">
<li>First</li>
<li>Second</li>
<li>Third</li>
</ol>
Roman:
<ol type="I">
<li>First</li>
<li>Second</li>
<li>Third</li>
</ol>
</body>
</html>
Problem
Create an unordered list where "Drinks" has sub-items: Tea, Coffee, Juice. And
"Snacks" has sub-items: Biscuit, Cake.
Menu:
• Drinks
○ Tea
○ Coffee
○ Juice
• Snacks
○ Biscuit
○ Cake
How to think
Step 1: Put a new <ul> (or <ol> ) inside an <li> to make it a sub-list.
Solution
<html>
<head>
<title>Nested List</title>
</head>
<body>
Menu:
<ul type="disc">
<li>Drinks
<ul type="circle">
<li>Tea</li>
<li>Coffee</li>
<li>Juice</li>
</ul>
</li>
<li>Snacks
<ul type="circle">
<li>Biscuit</li>
<li>Cake</li>
</ul>
</li>
</ul>
</body>
</html>
Problem
Create a list where the main items are bullets, but the sub-items are numbered.
Subjects:
• Science
1. Physics
2. Chemistry
• Arts
1. History
2. Geography
How to think
The outer list is <ul> , the inner list (inside each <li> ) is <ol> .
Solution
<html>
<head>
<title>Mixed Nested List</title>
</head>
<body>
Subjects:
<ul type="disc">
<li>Science
<ol type="1">
<li>Physics</li>
<li>Chemistry</li>
</ol>
</li>
<li>Arts
<ol type="1">
<li>History</li>
<li>Geography</li>
</ol>
</li>
</ul>
</body>
</html>
Topic 4: Tables
Problem
Create a table with 2 rows and 3 columns. Fill it with numbers. Add border=1.
What it looks like
+-----+-----+-----+
| A | B | C |
+-----+-----+-----+
| 1 | 2 | 3 |
+-----+-----+-----+
How to think
Step 2: Each row is a <tr> . Inside each row, each cell is a <td> .
Step 3: 2 rows = 2 <tr> tags. 3 columns = 3 <td> tags inside each row.
Solution
<html>
<head>
<title>Simple Table</title>
</head>
<body>
<table border="1">
<tr>
<td>A</td>
<td>B</td>
<td>C</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
</table>
</body>
</html>
Problem
Create a table with headings in the first row: Name, Age, City. Then add two rows of
data.
+--------+-----+----------+
| Name | Age | City |
+--------+-----+----------+
| Alice | 20 | Dhaka |
+--------+-----+----------+
| Bob | 22 | Chittagong |
+--------+-----+----------+
How to think
Step 1: Use <th> instead of <td> for heading cells. <th> is automatically bold and
centered.
Step 2: Put <th> inside the first <tr> . Put <td> inside the rest.
Solution
<html>
<head>
<title>Table with Headings</title>
</head>
<body>
<table border="1">
<tr>
<th>Name</th>
<th>Age</th>
<th>City</th>
</tr>
<tr>
<td>Alice</td>
<td>20</td>
<td>Dhaka</td>
</tr>
<tr>
<td>Bob</td>
<td>22</td>
<td>Chittagong</td>
</tr>
</table>
</body>
</html>
Problem
Create two tables side by side. First one has cellpadding=10, second has
cellspacing=10. Both have border=1. See the difference.
How to think
Step 1: cellpadding adds space INSIDE the cell (between text and border).
Solution
<html>
<head>
<title>Cellpadding and Cellspacing</title>
</head>
<body>
Cellpadding=10 (space inside):
<table border="1" cellpadding="10">
<tr>
<td>A</td>
<td>B</td>
</tr>
<tr>
<td>C</td>
<td>D</td>
</tr>
</table>
<br><br>
Problem
Create a table where the top row has one big cell that spans 3 columns. The bottom
row has 3 normal cells.
+-------------------------+
| Merged Header |
+--------+--------+-------+
| Col 1 | Col 2 | Col 3 |
+--------+--------+-------+
How to think
Step 2: When one cell spans 3 columns, you don't put 3 cells in that row — just 1.
Solution
<html>
<head>
<title>Colspan</title>
</head>
<body>
<table border="1">
<tr>
<th colspan="3">Merged Header</th>
</tr>
<tr>
<td>Col 1</td>
<td>Col 2</td>
<td>Col 3</td>
</tr>
</table>
</body>
</html>
Problem
Create a table where the first cell spans 2 rows. The right side has two separate rows.
+--------+--------+
| | Row 1 |
| A +--------+
| | Row 2 |
+--------+--------+
How to think
Step 2: In the second row, you don't put a cell where the spanning cell is — it's
already filled.
Solution
<html>
<head>
<title>Rowspan</title>
</head>
<body>
<table border="1">
<tr>
<td rowspan="2">A</td>
<td>Row 1</td>
</tr>
<tr>
<td>Row 2</td>
</tr>
</table>
</body>
</html>
Exercise 6: Table with empty boxes (full boxes and empty boxes)
Problem
Create a 2x2 table. One cell has text, one cell is empty but shows borders, one cell
uses (non-breaking space) to keep the border visible, and one cell has a different
background color.
+-----------+-----------+
| Has text | (empty) |
| | border |
| | visible |
+-----------+-----------+
| (nbsp) | Colored |
| border | cell |
| visible | (red bg) |
+-----------+-----------+
How to think
Step 2: To force the border to show in an empty cell, put inside. is a
non-breaking space character.
Step 3: That's what HSC exam questions mean by "empty boxes" vs "full boxes" —
whether the borders are visible in empty cells.
Solution
<html>
<head>
<title>Empty and Full Boxes</title>
</head>
<body>
<table border="1">
<tr>
<td>Has text</td>
<td></td>
</tr>
<tr>
<td> </td>
<td bgcolor="red">Colored cell</td>
</tr>
</table>
<p>Top-right cell has no border in some browsers.</p>
<p>Bottom-left cell uses &nbsp; to keep the border visible.</p>
</body>
</html>
Problem
Create a class timetable with 3 days (Sat, Sun, Mon) and 3 periods. Add a heading
row. Use colspan for a title.
+------------------------------+
| Class Timetable |
+--------+--------+-----------+
| Day | Period 1 | Period 2 |
+--------+----------+---------+
| Sat | Math | Physics |
+--------+----------+---------+
| Sun | English | Chemistry |
+--------+----------+---------+
| Mon | Biology | ICT |
+--------+----------+---------+
How to think
Step 1: First row has 1 cell with colspan="3" for the title.
Solution
<html>
<head>
<title>Timetable</title>
</head>
<body>
<table border="1">
<tr>
<th colspan="3">Class Timetable</th>
</tr>
<tr>
<th>Day</th>
<th>Period 1</th>
<th>Period 2</th>
</tr>
<tr>
<td>Sat</td>
<td>Math</td>
<td>Physics</td>
</tr>
<tr>
<td>Sun</td>
<td>English</td>
<td>Chemistry</td>
</tr>
<tr>
<td>Mon</td>
<td>Biology</td>
<td>ICT</td>
</tr>
</table>
</body>
</html>
Problem
Create a table that uses bgcolor, align, width, height, cellpadding, and cellspacing
together.
How to think
Just put all the attributes inside <table> at once. The order of attributes doesn't
matter.
Solution
<html>
<head>
<title>Full Attribute Table</title>
</head>
<body>
<table border="1" width="400" height="150"
cellpadding="5" cellspacing="3"
bgcolor="lightyellow" align="center">
<tr>
<th align="center" bgcolor="lightblue">Name</th>
<th align="center" bgcolor="lightblue">Score</th>
</tr>
<tr>
<td align="left">Alice</td>
<td align="right">95</td>
</tr>
<tr>
<td align="left" valign="top">Bob</td>
<td align="right" valign="bottom">87</td>
</tr>
</table>
</body>
</html>
Link attributes: - href="[Link]" — where the link goes (can be a file or full
URL) - target="_blank" — opens link in a new tab - name="top" — marks a position
on the page (bookmark)
Image attributes: - src="[Link]" — the image file name or path -
alt="description" — text shown if image doesn't load - width="100" — image width
in pixels - height="50" — image height in pixels - border="2" — border around the
image - align="left" or "right" — text flows around the image
Problem
Create a link that says "Visit Google" and opens [Link] Make it
open in a new tab.
How to think
Solution
<html>
<head>
<title>Hyperlink</title>
</head>
<body>
<a href="[Link] target="_blank">Visit Google</a>
</body>
</html>
Problem
Solution
<html>
<head>
<title>Internal Link</title>
</head>
<body>
<a href="[Link]">About Us</a>
</body>
</html>
Problem
Show an image called "[Link]". If it doesn't load, show the text "My Photo". Make
it 200 pixels wide.
Solution
<html>
<head>
<title>Image</title>
</head>
<body>
<img src="[Link]" alt="My Photo" width="200" border="1">
</body>
</html>
Problem
How to think
Step 2: When you click the image, the browser follows the link.
Solution
<html>
<head>
<title>Image Link</title>
</head>
<body>
<a href="[Link]
<img src="[Link]" alt="Click to visit Google" width="100">
</a>
</body>
</html>
Exercise 5: Bookmark (named anchor)
Problem
Create a long page with links at the top that jump down to sections. At the bottom, a
"Back to Top" link.
How to think
Step 2: Link to it with <a href="#top">Back to Top</a> . The # means "same page,
go to this name".
Solution
<html>
<head>
<title>Bookmark</title>
</head>
<body>
<a name="top"></a>
<h1>Contents</h1>
<a href="#section1">Go to Section 1</a><br>
<a href="#section2">Go to Section 2</a><br><br>
<a name="section1"></a>
<h2>Section 1</h2>
<p>This is section 1. Lots of text here...</p>
<p>More text...</p>
<p>More text...</p>
<a href="#top">Back to Top</a>
<a name="section2"></a>
<h2>Section 2</h2>
<p>This is section 2.</p>
<a href="#top">Back to Top</a>
</body>
</html>
Problem
Create a login form with a username field and a password field. Add a submit button.
Username: [_______________]
Password: [_______________]
[Submit]
How to think
Step 1: <form> wraps everything. Add action and method if needed (for HSC, just a
basic form is fine).
Solution
<html>
<head>
<title>Login Form</title>
</head>
<body>
<form>
Username: <input type="text" name="username"><br>
Password: <input type="password" name="password"><br>
<input type="submit" value="Login">
</form>
</body>
</html>
Problem
Create a form asking for gender with two radio buttons: Male and Female. Make
Female selected by default.
How to think
Step 1: Radio buttons with the same name work as a group — you can only select
one.
Solution
<html>
<head>
<title>Radio Buttons</title>
</head>
<body>
<form>
Gender:
<input type="radio" name="gender" value="male"> Male
<input type="radio" name="gender" value="female" checked> Female
</form>
</body>
</html>
Problem
Create a form asking which subjects you like. Options: Math, Physics, ICT. ICT is
checked by default.
Solution
<html>
<head>
<title>Checkboxes</title>
</head>
<body>
<form>
Subjects you like:<br>
<input type="checkbox" name="subject" value="math"> Math
<input type="checkbox" name="subject" value="physics"> Physics
<input type="checkbox" name="subject" value="ict" checked> ICT
</form>
</body>
</html>
Problem
City: [Chittagong ▼]
| Dhaka |
| Chittagong |
| Rajshahi |
| Khulna |
How to think
<html>
<head>
<title>Drop-down List</title>
</head>
<body>
<form>
City:
<select name="city">
<option value="dhaka">Dhaka</option>
<option value="chittagong" selected>Chittagong</option>
<option value="rajshahi">Rajshahi</option>
<option value="khulna">Khulna</option>
</select>
</form>
</body>
</html>
Problem
Create a form with a textarea for writing comments. It should be 4 rows tall and 30
columns wide.
Comments:
┌──────────────────────────────┐
│ │
│ │
│ │
│ │
└──────────────────────────────┘
Solution
<html>
<head>
<title>Textarea</title>
</head>
<body>
<form>
Comments:<br>
<textarea name="comments" rows="4" cols="30"></textarea>
</form>
</body>
</html>
Problem
Create a complete form with: name (text), password, gender (radio), city (select),
and both submit and reset buttons.
Name: [_______________]
Password: [_______________]
Gender: ○ Male ● Female
City: [Dhaka ▼]
[Submit] [Reset]
How to think
Solution
<html>
<head>
<title>Full Form</title>
</head>
<body>
<form>
Name: <input type="text" name="name"><br>
Password: <input type="password" name="password"><br>
Gender:
<input type="radio" name="gender" value="male"> Male
<input type="radio" name="gender" value="female" checked> Female
<br>
City:
<select name="city">
<option value="dhaka">Dhaka</option>
<option value="chittagong">Chittagong</option>
<option value="rajshahi">Rajshahi</option>
</select>
<br>
<input type="submit" value="Submit">
<input type="reset" value="Reset">
</form>
</body>
</html>
Problem
Show "Welcome to my site!" scrolling from right to left. Make the background yellow.
How to think
Solution
<html>
<head>
<title>Marquee</title>
</head>
<body>
<marquee bgcolor="yellow">Welcome to my site!</marquee>
</body>
</html>
Exercise 2: Marquee with different directions
Problem
Create three marquees: one scrolls left, one scrolls right, one bounces (alternate).
Solution
<html>
<head>
<title>Marquee Directions</title>
</head>
<body>
<marquee direction="left">Scrolling left</marquee>
<marquee direction="right">Scrolling right</marquee>
<marquee behavior="alternate">Bouncing back and forth</marquee>
</body>
</html>
Problem
Build a single page about your school. Include: 1. A heading: "My School" 2. An
unordered list of 3 facilities 3. A table with subjects and teachers 4. A link to the
school website 5. An image of the school logo
Solution
<html>
<head>
<title>My School</title>
</head>
<body bgcolor="lightyellow">
<h1 align="center">My School</h1>
<hr>
<h3>Facilities:</h3>
<ul type="square">
<li>Computer Lab</li>
<li>Library</li>
<li>Playground</li>
</ul>
<br>
<img src="school_logo.jpg" alt="School Logo" width="100"><br>
Problem
Create a student registration form with: - Full Name (text) - Roll Number (text) - Class
(select: Six, Seven, Eight, Nine, Ten) - Gender (radio: Male, Female) - Subjects
(checkbox: Bangla, English, Math, ICT) - Comments (textarea) - Submit and Reset
buttons
Solution
<html>
<head>
<title>Registration Form</title>
</head>
<body>
<h2 align="center">Student Registration</h2>
<form>
Full Name: <input type="text" name="name"><br>
Roll Number: <input type="text" name="roll"><br>
Class:
<select name="class">
<option value="six">Six</option>
<option value="seven">Seven</option>
<option value="eight">Eight</option>
<option value="nine">Nine</option>
<option value="ten">Ten</option>
</select>
<br>
Gender:
<input type="radio" name="gender" value="male"> Male
<input type="radio" name="gender" value="female"> Female
<br>
Subjects:
<input type="checkbox" name="sub" value="bangla"> Bangla
<input type="checkbox" name="sub" value="english"> English
<input type="checkbox" name="sub" value="math"> Math
<input type="checkbox" name="sub" value="ict"> ICT
<br>
Comments:<br>
<textarea name="comments" rows="3" cols="40"></textarea>
<br>
<input type="submit" value="Register">
<input type="reset" value="Clear">
</form>
</body>
</html>
What is a Website?
A collection of web pages stored on the same server under the same domain name.
The first page of a website that opens when you visit the domain. Usually named
[Link] .
What is a Browser?
Software used to access and display websites. Examples: Google Chrome, Mozilla
Firefox, Microsoft Edge, Brave.
Software that searches the internet and finds information. Examples: Google, Yahoo,
Bing, DuckDuckGo.
A website that provides multiple important links and services in one place. Example:
[Link].
What is an IP Address?
A unique numeric address of every device connected to the internet. - IPv4: 32-bit,
written as 4 numbers (e.g., [Link]). Total possible: 2^32. - IPv6: 128-bit,
written in hexadecimal. Total possible: 2^128.
A server that converts domain names into IP addresses. When you type [Link] ,
DNS finds its IP address so your browser can load the page.
What is URL?
Uniform Resource Locator. The full address of a resource on the internet (e.g.,
[Link] ).
What is HTML?
HyperText Markup Language. The standard language used to create web pages.
What is CSS?
Cascading Style Sheets. Used to style and design web pages (colors, fonts, layout).
Network
Any page can link to any other page. Wikipedia
Structure
Type Description Example
• HTTP: HyperText Transfer Protocol. Used to transfer data between web server
and browser.
• HTTPS: Secure version of HTTP. Data is encrypted.
Basic Structure
Text Formatting
Tag Purpose
<b> Bold
<i> Italic
<u> Underline
Tag Purpose
<p> Paragraph
Other Tags
Tag Purpose
Lists
Tag Purpose
Tag Purpose
Forms
Tag Purpose
Color Color
red blue
green yellow
orange purple
white black
gray pink
Color Color
lightblue lightyellow
lightgreen lightgray
Special Characters
Code Shows
< <
> >
& &
Memory Aids
Table structure order: Table → Row → Data. Start from the outside and go in.
<table> (first)
<tr> (second)
<td> (third)
<b><i><u>text</u></i></b> ✓
<b><i><u>text</b></i></u> ✗ WRONG