Courses / Application of ICT (GEN-103) – BS 1st Semester
Week 17 Lab 17 – HTML: Hyperlinks, Frames, Images, Backgrounds and Colours (Mini Website)
Week 17 – HTML Links, Images, Colours, Frames and Tables · 100 min read · 8 MCQs to check yourself
Lab objectives
Build a small multi-page website using hyperlinks, images, background images, background and foreground colours, and frames.
Task 1 – Prepare the folder
In ICT-Web create: index.html, about.html, courses.html, contact.html, a sub-folder images with logo.png and campus.jpg (any pictures), and bg.jpg (light texture).
Task 2 – Home page with links, images and colours (index.html)
<!DOCTYPE html>
<html>
<head><title>IT Department – Home</title></head>
<body bgcolor="#F5F9FF" text="#1A237E" link="blue" vlink="purple" alink="red">
<center>
<img src="images/logo.png" alt="Department logo" width="120" height="120">
<h1>Department of Information Technology</h1>
</center>
<hr>
<p>
<a href="index.html">Home</a> |
<a href="about.html">About</a> |
<a href="courses.html">Courses</a> |
<a href="contact.html">Contact</a> |
<a href="https://www.hec.gov.pk" target="_blank">HEC (new tab)</a>
</p>
<img src="images/campus.jpg" alt="Our campus" width="400" border="2" align="right">
<p>Welcome to the IT department. We offer BS IT and BS CS programmes.</p>
<p><a href="#news">Jump to latest news</a></p>
<br><br><br><br><br><br>
<h2 id="news"><font color="darkred">Latest News</font></h2>
<p>Admissions for Fall are open.</p>
<p><a href="mailto:it@university.edu.pk">Email the department</a></p>
<p><a href="index.html"><img src="images/logo.png" alt="Home" width="40"></a> ← image link to Home</p>
</body>
</html>
Task 3 – Background image page (about.html)
<!DOCTYPE html>
<html>
<head><title>About Us</title></head>
<body background="bg.jpg" text="black">
<h1>About Us</h1>
<p><font color="green">Established in 2005, the department ...</font></p>
<p><a href="index.html">Back to Home</a></p>
</body>
</html>
Task 4 – Table with colours (courses.html)
Use a table of courses with bgcolor on the header row and alternating row colours, plus a link back to Home.
Task 5 – Frames (frames.html)
Create menu.html:
<!DOCTYPE html>
<html>
<head><title>Menu</title></head>
<body bgcolor="#E8EAF6">
<h3>Menu</h3>
<a href="index.html" target="main">Home</a><br>
<a href="about.html" target="main">About</a><br>
<a href="courses.html" target="main">Courses</a><br>
<a href="contact.html" target="main">Contact</a>
</body>
</html>
Create frames.html:
<!DOCTYPE html>
<html>
<head><title>IT Department – Frames</title></head>
<frameset rows="15%,*">
<frame src="header.html" noresize scrolling="no">
<frameset cols="20%,80%">
<frame src="menu.html" name="menu">
<frame src="index.html" name="main">
</frameset>
<noframes>Your browser does not support frames.</noframes>
</frameset>
</html>
(header.html contains just the department name.) Clicking a menu link opens the page in the main frame because of target="main".
Note:
<frameset>is obsolete in HTML5 but still taught and supported by most browsers for learning. The modern alternative is<iframe>:
<iframe src="courses.html" width="600" height="300" title="Courses"></iframe>
<iframe width="560" height="315" src="https://www.youtube.com/embed/qz0aGYrrlhU" title="HTML tutorial"></iframe>
Checklist before submission
- All links work (internal, external in new tab, email, same-page, image link).
- All images have
alttext and load (correct relative pathimages/…). - Background colour, background image and text colours applied.
- Frames page loads menu and main page correctly.
Lab exercise (submit)
Build a 4-page personal portfolio website (Home, About Me, My Projects, Contact) with: a navigation bar of links on every page; your photo with alt text; one page with a background image; foreground and background colours; an email link; an external link opening in a new tab; a same-page "Back to top" link; and a frames.html page showing a menu frame (left) and content frame (right). Zip the folder and submit.
HTML Crash Course (links and images) – Programming with Mosh
Short and long questions
1. Write HTML code for a home page that has a logo image, a navigation bar of hyperlinks, background and text colours, an external link opening in a new tab, an email link and a same-page link.
Model answer
<!DOCTYPE html>
<html>
<head><title>My Website</title></head>
<body bgcolor="#FFF8E1" text="#3E2723" link="blue" vlink="purple">
<center><img src="images/logo.png" alt="Logo" width="100"></center>
<h1>Welcome</h1>
<p>
<a href="index.html">Home</a> |
<a href="about.html">About</a> |
<a href="contact.html">Contact</a>
</p>
<p><a href="https://www.w3schools.com" target="_blank">Learn HTML</a></p>
<p><a href="mailto:me@example.com">Email me</a></p>
<p><a href="#bottom">Go to bottom</a></p>
<p id="bottom"><font color="green">End of page</font></p>
</body>
</html>
<img> with src/alt/width inserts the logo; <a href> creates links; bgcolor and text set background and foreground colours; link/vlink set link colours; target="_blank" opens a new tab; mailto: creates an email link; #bottom jumps to the element with id="bottom".
2. Write HTML code for: a link to Google opening in a new tab, an email link, and an image link to the home page.
Model answer
<a href="https://www.google.com" target="_blank">Google</a>; <a href="mailto:info@uni.edu.pk">Email us</a>; <a href="index.html"><img src="logo.png" alt="Home"></a>.
3. Write code for a frameset with a menu frame on the left (25%) and content frame on the right.
Model answer
<frameset cols="25%,75%"> <frame src="menu.html" name="menu"> <frame src="home.html" name="main"> </frameset> — links in menu.html use target="main" to open pages in the right frame.
This lesson ends with a quiz of 8 MCQs. Open the lesson on PrepOasis to take it and save your progress.
Previous: Week 17 Theory – Hyperlinks, Images, Colours, Frames and Tables in HTML · Next: Final Exam Revision and Exam Guide (Weeks 1–17)
All lessons in Application of ICT (GEN-103) – BS 1st Semester