Courses / Application of ICT (GEN-103) – BS 1st Semester

Week 14 Lab 14 – HTML: Creating Your First Web Page

Week 14 – The Internet and Web Browsers · 90 min read · 8 MCQs to check yourself

Lab objectives

Write, save and open your first HTML document using a text editor; practise HTML tags, head and body; edit and refresh.

Tools needed

Task 1 – Create a folder

Create a folder D:\ICT-Web (or in Documents) to keep all your web pages and images together.

Task 2 – Type your first HTML document

Open Notepad and type exactly:

<!DOCTYPE html>
<html>
<head>
  <title>My First Web Page</title>
</head>
<body>
  <h1>Welcome to My Web Page</h1>
  <p>My name is Ayesha Khan. I am a student of BS IT, Semester 1.</p>
  <p>This page was created in the ICT lab using HTML.</p>
  <!-- This is a comment and will not be displayed -->
</body>
</html>

Task 3 – Save the file correctly

  1. File → Save As.
  2. Browse to ICT-Web.
  3. Save as type: choose All Files (*.*) (otherwise Notepad adds .txt).
  4. File name: index.html (or first.html).
  5. Encoding: UTF-8 → Save.

The file icon now shows the browser logo.

Task 4 – Open in a browser

Task 5 – Edit and refresh

  1. Keep both Notepad and the browser open.
  2. Change the text in Notepad (e.g. add another paragraph) → Ctrl + S.
  3. Switch to the browser → press F5 (Refresh) to see changes.
  4. View page source in the browser: right-click → View page source (Ctrl + U). Inspect (F12) shows the elements.

Task 6 – Practise head and body tags

Add to the <head>:

<head>
  <meta charset="UTF-8">
  <meta name="description" content="Personal page of a BS IT student">
  <meta name="author" content="Ayesha Khan">
  <title>Ayesha – BS IT Student</title>
</head>

Add body attributes (older HTML style practised in the syllabus):

<body bgcolor="lightyellow" text="darkblue">

Observe: the background colour and text colour of the whole page change. Information in <head> is not displayed on the page (except the title on the tab).

Common mistakes and fixes

Problem Cause / fix
File opens in Notepad instead of browser Saved as index.html.txt – choose All Files when saving
Tags appear on the page as text Missing < or >, or file saved as .txt
Changes not visible Forgot to save (Ctrl + S) or refresh (F5)
Whole page becomes bold/big A tag was not closed (e.g. missing </h1>)
Strange characters Save with UTF-8 encoding

Lab exercise (submit)

Create aboutme.html with title "About [Your Name]", a main heading with your name, three paragraphs (introduction, hobbies, future goals), a comment line, meta author tag, and body background colour of your choice. Save, open in the browser, change one paragraph, refresh and show the page source.

HTML Tutorial for Beginners: HTML Crash Course (Programming with Mosh)

Short and long questions

1. Write a complete HTML document for a personal web page and explain each tag used.

Model answer
<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>Ali Raza – Personal Page</title>
</head>
<body bgcolor="lightcyan" text="navy">
  <h1>Ali Raza</h1>
  <p>I am a student of BS Information Technology.</p>
  <p>My hobbies are reading, cricket and coding.</p>
  <!-- end of page -->
</body>
</html>

<!DOCTYPE html> declares HTML5; <html> is the root element; <head> holds page information; <meta charset> sets character encoding; <title> shows text on the browser tab; <body> holds visible content with bgcolor (background) and text (text colour); <h1> is the main heading; <p> creates paragraphs; <!-- --> is a comment not displayed.

2. Write the steps to create, save and view an HTML page using Notepad.

Model answer

Open Notepad → type the HTML code → File → Save As → choose the folder → Save as type: All Files → name the file with .html extension (e.g. index.html) → Encoding UTF-8 → Save → double-click the file (or Open with → browser) to view; after editing press Ctrl+S and refresh the browser with F5.

3. What information is placed in the head section of an HTML page?

Model answer

The head contains information about the page that is not displayed in the page area: the title (shown on the browser tab), meta tags (charset, description, author, keywords), links to CSS files, scripts and styles.

This lesson ends with a quiz of 8 MCQs. Open the lesson on PrepOasis to take it and save your progress.

Previous: Week 14 Theory – The Internet, Browsers and Search Engines · Next: Week 15 Theory – The World Wide Web

All lessons in Application of ICT (GEN-103) – BS 1st Semester