Web Design & Intermediate Programming

Class 7 · Ages 12–13
And He taught man that which he knew not. (96:5)
CSS Styling · Python Programming · Number Systems · Operating Systems · Networks · Data Privacy

Learning Objectives

Topic 1 CSS: Styling Web Pages

What is CSS?

CSS (Cascading Style Sheets) is the language used to style and design web pages. While HTML provides the structure, CSS makes the page look beautiful by adding colors, fonts, spacing, and layouts.

Think of CSS like the decorations in a room. HTML is the walls, doors, and windows – CSS is the paint, furniture, and decorations.

Fun Fact!

CSS was first proposed in 1994 by Håkon Wium Lie. Before CSS, web pages were styled using HTML tags like <font> and <center>!

CSS Syntax

A CSS rule has two parts: a selector (which element to style) and declarations (the styles to apply).

/* Selector: targets HTML elements */
h1 {
    color: blue;
    font-size: 36px;
    text-align: center;
}

Common CSS Properties

  • color – Text color. Example: color: blue;
  • background-color – Background color. Example: background-color: #f0f0f0;
  • font-size – Size of text. Example: font-size: 18px;
  • font-family – Typeface for text. Example: font-family: Arial, sans-serif;
  • margin – Space outside an element. Example: margin: 10px;
  • padding – Space inside an element. Example: padding: 15px;
  • border – Border around an element. Example: border: 2px solid black;
  • width – Width of an element. Example: width: 200px;
🎨 color 🖌️ background 📏 font-size 📐 margin 📦 padding 🖼️ border
Common CSS Properties

Types of CSS

  • Inline CSS – Styles applied directly to an HTML element.
    <p style="color: red;">This is red text.</p>
  • Internal CSS – Styles written inside the <style> tag in the HTML head.
    <style>
        p { color: blue; }
    </style>
  • External CSS – Styles written in a separate .css file and linked to the HTML.
    <link rel="stylesheet" href="style.css">
Try This!

Create a simple CSS-styled page:

1. Create an HTML page with a heading and a paragraph.
2. Add CSS to make the heading blue and centered.
3. Add CSS to make the paragraph text larger and have a background color.

You've styled your first web page!

Activity

Design a "My Favorite Things" webpage using CSS:

Include:
1. A heading with a background color.
2. A list of your favorite things with different colors.
3. Each item with a border and padding.
4. A paragraph with a different font and text color.

Save your page and open it in a browser.

Reflect

Allah has created the world with beauty and design. The Qur'an says: "He has made everything beautiful that He has created." (32:7)

When you style web pages, you are creating beauty in the digital world. Use your skills to create beautiful and useful websites that benefit others.

Key Takeaway

CSS is used to style web pages with colors, fonts, spacing, and layouts. CSS rules have selectors and declarations. Common properties include color, background-color, font-size, margin, padding, and border. CSS can be inline, internal, or external. CSS makes web pages beautiful and user-friendly.

Topic 2 Python Programming: Functions & Data Structures

Python: Beyond the Basics

In Class 6, you were introduced to programming concepts. Now it's time to learn more advanced Python skills, including functions, lists, and dictionaries.

Functions

A function is a reusable block of code that performs a specific task. Functions help you avoid repeating code.

def greet(name):
    print("Assalamu Alaikum", name)

greet("Ahmed") # Output: Assalamu Alaikum Ahmed

Lists

A list is a collection of items in order. You can add, remove, and access items in a list.

fruits = ["apple", "banana", "orange"]
print(fruits[0]) # Output: apple
fruits.append("grape") # Add an item
for fruit in fruits:
    print(fruit)
Fun Fact!

Python's name comes from the British comedy group Monty Python, not the snake! The creator, Guido van Rossum, was a fan of the show.

Dictionaries

A dictionary stores key-value pairs. It's like a real dictionary – you look up a word (key) to find its meaning (value).

student = {
    "name": "Fatima",
    "age": 12,
    "grade": "A"
}
print(student["name"]) # Output: Fatima
Try This!

Create a Python program with a function and a list:

1. Define a function that takes a list of numbers and returns the sum.
2. Create a list of 5 numbers.
3. Call the function and print the result.

You're coding in Python!

Activity

Write a Python program that:

1. Defines a function to calculate the average of a list of numbers.
2. Creates a list of student grades.
3. Calculates and prints the average.
4. Uses a dictionary to store a student's name, age, and favorite subject.

Test your program with different values.

Reflect

Allah has given us the ability to create and solve problems. The Qur'an says: "And He taught Adam the names – all of them." (2:31)

Programming is a way of organizing our thoughts and solving problems in a logical way. Use your coding skills to make a difference in the world.

Key Takeaway

Functions are reusable blocks of code that perform specific tasks. Lists are ordered collections of items. Dictionaries store key-value pairs. These concepts are essential for writing efficient and organized Python code. Practice writing functions and using data structures to solve problems.

Topic 3 Number Systems

Why Do We Need Different Number Systems?

Computers use different number systems for different purposes. The binary system (base-2) is used internally. Octal (base-8) and hexadecimal (base-16) are used to make binary more readable for humans.

Binary (Base-2)

  • Uses only 0 and 1. Each position represents a power of 2. Example: 1010₂ = 1×8 + 0×4 + 1×2 + 0×1 = 10₁₀
  • Why? Computers are made of switches that are either ON (1) or OFF (0).

Octal (Base-8)

  • Uses digits 0-7. Each position represents a power of 8. Example: 27₈ = 2×8 + 7×1 = 23₁₀
  • Why? Each octal digit represents 3 binary digits, making it easier to read.
Fun Fact!

The word "bit" is short for "binary digit". The term was coined by the mathematician John Tukey in 1946.

Hexadecimal (Base-16)

  • Uses digits 0-9 and letters A-F (10-15). Each position represents a power of 16. Example: 1Aₓ = 1×16 + 10×1 = 26₁₀
  • Why? Each hex digit represents 4 binary digits (a nibble), and 2 hex digits make a byte. Example: FFₓ = 255₁₀ = 11111111₂
🔢 Binary Base-2 0, 1
🔢 Octal Base-8 0-7
🔢 Hex Base-16 0-9, A-F
Three Important Number Systems
Conversion Practice

Binary to Decimal:
1001₂ = 1×8 + 0×4 + 0×2 + 1×1 = 9₁₀

Octal to Decimal:
73₈ = 7×8 + 3×1 = 56 + 3 = 59₁₀

Hex to Decimal:
F3ₓ = 15×16 + 3×1 = 240 + 3 = 243₁₀

Activity

Convert these numbers:

1. 1101₂ = _____₁₀
2. 56₈ = _____₁₀
3. 2Aₓ = _____₁₀
4. 100₈ = _____₁₀
5. FFₓ = _____₁₀

Check your answers with a partner.

Reflect

The different number systems show us how computers organize information. The Qur'an says: "And everything with Him is by measure." (13:8)

Just as computers use precise systems, Allah has created the universe with order and precision. Understanding number systems helps us appreciate this order.

Key Takeaway

Number systems include binary (base-2), octal (base-8), and hexadecimal (base-16). Binary uses 0 and 1, octal uses 0-7, and hex uses 0-9 and A-F. Each system serves a different purpose in computing. Converting between number systems is a fundamental skill in computer science.

Topic 4 Operating Systems

What is an Operating System?

An operating system (OS) is the most important software on a computer. It manages hardware, software, and user interaction. Without an OS, a computer can't do anything.

Functions of an Operating System

  • 🔌 Hardware Management – Controls the CPU, memory, storage, and input/output devices.
  • 📂 File Management – Organizes files and folders on storage devices.
  • 🔄 Process Management – Manages running programs and allocates CPU time.
  • 👤 User Interface – Provides a way for users to interact with the computer (GUI – Graphical User Interface or CLI – Command Line Interface).
  • 🔒 Security – Protects the system from unauthorized access and threats.
🔌 Hardware 📂 Files 🔄 Processes 👤 Interface 🔒 Security
Functions of an Operating System
Fun Fact!

The first operating system for personal computers was CP/M (Control Program for Microcomputers), created in 1974. MS-DOS and Windows followed later.

Types of Operating Systems

  • 🪟 Windows – The most popular OS for personal computers. Developed by Microsoft.
  • 🍎 macOS – Used on Apple computers. Developed by Apple Inc.
  • 🐧 Linux – An open-source OS used on servers and some personal computers. Free and customizable.
  • 📱 Android – Used on most smartphones and tablets. Based on Linux, developed by Google.
  • 🍏 iOS – Used on iPhones and iPads. Developed by Apple Inc.
Story: The Operating System

Imagine a computer as a busy office. The operating system is the office manager who:

• Assigns tasks to the right people (CPU management).
• Keeps files organized in filing cabinets (file management).
• Makes sure everyone has the tools they need (device management).
• Answers the phone and greets visitors (user interface).
• Locks the doors at night (security).

The lesson: The operating system is the unsung hero that makes everything work smoothly on your computer.

Activity

Find out which operating system you are using!

1. Check your computer's settings to find the OS name and version.
2. If you have a phone, check what OS it uses.
3. Write down the names of three different operating systems.
4. Compare the features of two different OSs.

Share your findings with the class.

Reflect

The operating system is like the nervous system of a computer. Allah has created the human body with a nervous system that coordinates everything. The Qur'an says: "And He taught man that which he knew not." (96:5)

Just as the body has a system, computers have operating systems. This is a sign of the wisdom and order in creation.

Key Takeaway

An operating system manages hardware, software, and user interaction. Key functions include hardware management, file management, process management, user interface, and security. Common operating systems include Windows, macOS, Linux, Android, and iOS. Understanding operating systems helps us use computers more effectively.

Topic 5 Computer Networks

Understanding Computer Networks

A computer network connects computers and devices to share resources, communicate, and exchange information. Networks are the foundation of the modern digital world.

Types of Networks

  • 🏠 PAN (Personal Area Network) – A small network around a person, like Bluetooth devices. Example: Connecting your phone to wireless earbuds.
  • 🏢 LAN (Local Area Network) – A network in a small area like a home, school, or office. Example: Computers in a school computer lab.
  • 🏙️ MAN (Metropolitan Area Network) – A network that covers a city. Example: A city's public Wi-Fi network.
  • 🌍 WAN (Wide Area Network) – A network that covers a large area, like a country or the world. Example: The internet is the largest WAN.
🏠 PAN 🏢 LAN 🏙️ MAN 🌍 WAN
Types of Computer Networks
Fun Fact!

The internet as we know it started in 1983 when the ARPANET adopted the TCP/IP protocol. Before that, different networks couldn't talk to each other!

Network Topologies

A network topology is how devices are connected in a network.

  • ⭐ Star Topology – All devices connect to a central hub or switch. Most common in homes and offices.
  • 🔁 Ring Topology – Each device connects to two others, forming a ring. Data travels in one direction.
  • 🌐 Bus Topology – All devices connect to a single cable (bus). Older technology, less common now.
  • 🌿 Mesh Topology – Every device connects to every other device. Most reliable but expensive.
Think About It

What topology does your school use?

In most schools, computers are connected in a star topology. All the computers connect to a central switch, which connects to the internet.

If one computer fails, the others still work. This is the advantage of a star topology.

Activity

Draw a diagram of a network topology.

Choose one topology: Star, Ring, Bus, or Mesh.

Include:
1. Devices (computers, printers, etc.).
2. Connections (cables or wireless).
3. A central device (if applicable).

Label each part and explain the topology.

Reflect

Networks connect people across the world. The Qur'an says: "O mankind, indeed We have created you from male and female and made you peoples and tribes that you may know one another..." (49:13)

Computer networks are a way to connect and understand each other. Use this connection to share knowledge and help others.

Key Takeaway

Computer networks connect devices to share resources and information. Types include PAN, LAN, MAN, and WAN. Topologies include star, ring, bus, and mesh. Understanding networks is essential for understanding how the internet and modern communication work.

Topic 6 Data Privacy & Digital Responsibility

What is Data Privacy?

Data privacy is the protection of personal information from unauthorized access and misuse. It's about having control over who can see and use your data.

Types of Personal Data

  • Identity – Name, date of birth, address, ID numbers. Never share these online!
  • Financial – Bank details, credit card numbers, income. Only share with trusted institutions.
  • Online Behavior – Websites visited, search history, online purchases. Companies often collect this data.
  • Communication – Emails, messages, social media posts. Be careful about what you share.
Fun Fact!

Data privacy laws exist in many countries. The GDPR in Europe is one of the strictest data protection laws in the world, giving people control over their personal data.

Protecting Your Data

  • 🔐 Use Strong, Unique Passwords – Don't use the same password for multiple accounts. Use a password manager if needed.
  • 🔑 Enable Two-Factor Authentication (2FA) – Adds an extra layer of security. You'll need a code from your phone as well as your password.
  • 🔒 Think Before You Share – Only share personal information when necessary. Ask: "Does this person need to know this?"
  • 🔄 Review Privacy Settings – Check the privacy settings on your accounts and apps regularly. Limit who can see your information.
  • 📱 Be Careful with Public Wi-Fi – Avoid accessing sensitive information on public networks. Use a VPN if you need to use public Wi-Fi.
🔐 Passwords 🔑 2FA 🔒 Sharing 🔄 Settings 📱 Wi-Fi
Tips for Protecting Your Data

Digital Responsibility

  • 💬 Think Before You Post – Your digital footprint lasts forever. Ask: "Would I want my family to see this?"
  • ⚖️ Respect Others' Privacy – Don't share others' personal information without their permission. "And do not spy..." (49:12)
  • 🤝 Be Honest Online – Don't pretend to be someone you're not. "And do not mix truth with falsehood..." (2:42)
  • 🕊️ Promote Positive Content – Share things that benefit and uplift others. "And speak to people good words." (2:83)
Story: The Data Breach

A student named Fatima used the same password for her email, social media, and school account. One day, a website she used was hacked, and the hackers got her password. They tried the password on other accounts and accessed her school account.

The school's IT team detected the suspicious activity and blocked the account. Fatima learned a valuable lesson: always use different passwords for different accounts.

The lesson: Protecting your data is your responsibility. Use strong, unique passwords and be careful with your personal information.

Activity

Create a "Data Privacy" checklist for yourself.

Include:
1. 3 things you will do to protect your data.
2. 3 things you will stop doing to protect your data.
3. A reminder to review your privacy settings regularly.

Share your checklist with your family.

Reflect

Allah has entrusted us with responsibilities, including protecting ourselves and others. The Qur'an says: "And do not throw yourselves into destruction..." (2:195)

Protecting our data is a form of self-protection. When we are careful online, we are fulfilling our responsibility to ourselves and our community.

Key Takeaway

Data privacy is about protecting personal information. Use strong, unique passwords and two-factor authentication. Think before you share personal information. Digital responsibility means being honest, respectful, and positive online. Protecting your data is a personal and religious responsibility.

Class 7 Computer Science – Complete!

You've explored CSS styling, Python programming, number systems, operating systems, computer networks, and data privacy. You are building strong foundations in computer science! May Allah bless your learning and help you use technology for good!

Topic 1 Topic 2 Topic 3 Topic 4 Topic 5 Topic 6