Complete HTML, CSS & JavaScript Handbook
Complete HTML, CSS & JavaScript Handbook
Handbook
Part I — Web Fundamentals
Prerequisites: None
Learning Objectives
After completing this section, you will be able to:
1.1.1 Introduction
Every day, billions of people use the Internet to browse websites, send emails, watch videos,
communicate with friends, work remotely, shop online, and learn new skills. Despite using it
constantly, many people cannot clearly explain what the Internet actually is.
The Internet is not a website, a browser, or a single company. It is a vast infrastructure that
allows computers and other devices around the world to exchange information.
To become a web developer, understanding the Internet is essential. HTML, CSS, JavaScript,
and web servers all operate on top of this global network.
You need:
● Your address
● Your friend's address
● A postal service
● Rules for delivering mail
Postal Internet
System
Address IP address
This work led to ARPANET, a research network funded by the U.S. Department of Defense.
Over time, the technologies developed for ARPANET evolved into the modern Internet.
The World Wide Web, created later by Tim Berners-Lee, made the Internet much easier for the
public to use by introducing web pages, hyperlinks, and web browsers.
Examples include:
The Internet connects millions of these individual networks together, which is why it is often
called a network of networks.
Home Network
│
▼
Internet Service Provider
│
▼
Regional Network
│
▼
Global Internet Backbone
│
▼
Another ISP
│
▼
Office Network
Each network remains independent, but they cooperate using common communication
standards.
● Desktop computers
● Laptops
● Smartphones
● Tablets
● Smart TVs
● Gaming consoles
● Smart watches
● Security cameras
● Smart home devices
● Industrial sensors
● Cloud servers
Client Devices
Examples:
● Phone
● Laptop
● Tablet
Servers
Servers are powerful computers that provide services or store websites, applications,
databases, and files.
When you visit a website, your browser sends a request to a server, which responds with the
requested content.
Routers
Routers direct data between networks, choosing efficient paths for data packets to travel.
Examples include local broadband providers, mobile network operators, and fiber Internet
companies.
Internet Backbone
The Internet backbone consists of extremely high-speed fiber-optic networks operated by major
telecommunications companies. These networks carry enormous volumes of Internet traffic
across countries and continents.
[Link]
● Source address
● Destination address
● Sequence information
● A portion of the data
Routers forward these packets independently. At the destination, the packets are reassembled
into the original file.
This packet-based approach makes the Internet more reliable and efficient.
Although it appears seamless, thousands of network operations occur behind the scenes.
Key Terms
● Internet: A global network of interconnected computer networks.
● Network: A group of connected devices.
● Protocol: A set of rules for communication.
● Packet: A small unit of transmitted data.
● Router: A device that forwards packets between networks.
● Server: A computer that provides resources or services.
● Client: A device or application requesting resources.
● ISP: A company that provides Internet access.
● Backbone: High-capacity infrastructure connecting major networks.
Common Misconceptions
"The Internet and the Web are the same."
They are not. The Internet is the underlying network infrastructure; the World Wide Web is one
service that runs on it.
"Google is the Internet."
Google is a company offering online services. It relies on the Internet but is not the Internet
itself.
Chapter Check
1. Define the Internet in your own words.
2. Why is the Internet called a "network of networks"?
3. What is the role of an ISP?
4. What is a data packet?
5. Name five devices that can connect to the Internet.
6. Why are routers important?
Practical Exercise
Draw a simple diagram showing how your laptop or smartphone connects to a website. Include:
● Your device
● Wi-Fi router
● ISP
● Internet
● Web server
Then describe, in 5–10 sentences, what happens after you type a website address into your
browser.
Learning Objectives
After completing this section, you will be able to:
Scientists needed a way for computers to exchange information electronically over long
distances.
1.2.2 The Cold War and the Birth of
ARPANET
The origins of the Internet are closely linked to the Cold War.
The United States government wanted a communication system that could continue functioning
even if parts of the network were damaged. Instead of relying on one central communication
hub, researchers proposed connecting many computers together so that information could take
different routes if one path became unavailable.
To explore this idea, the Advanced Research Projects Agency (ARPA) funded a research
project called ARPANET.
ARPANET is widely regarded as the first large-scale packet-switched computer network and the
direct ancestor of today's Internet.
The first attempt to send a message over ARPANET was intended to transmit the word:
LOGIN
However, the system crashed after transmitting only the first two letters:
LO
Although the attempt failed, it demonstrated that remote computer communication was possible
and marked an important milestone in networking history.
1.2.4 Packet Switching
Traditional telephone systems establish a dedicated connection between two callers for the
duration of the call.
Instead of sending an entire file at once, data is divided into many small pieces called packets.
Packets can travel along different routes through the network and are reassembled when they
reach their destination.
Packet switching remains one of the core principles of modern Internet communication.
Researchers Vinton Cerf and Robert Kahn developed a standardized communication system
known as the Transmission Control Protocol/Internet Protocol (TCP/IP).
TCP/IP became the common language that allowed different networks to communicate.
IP (Internet Protocol)
IP is responsible for:
This date is often referred to as the official birth of the modern Internet, because it enabled
different networks to communicate using a common standard.
From this point forward, independent networks could join together to form a much larger
interconnected system.
[Link]
To solve this problem, the Domain Name System (DNS) was introduced.
[Link]
↓
[Link]
This innovation made the Internet much easier for people to use.
In 1989, Tim Berners-Lee, a computer scientist at CERN, proposed a system for sharing
documents using hyperlinks.
HTML
HTTP
The protocol used to transfer web pages between servers and browsers.
URL
These innovations became the foundation of the World Wide Web (WWW).
Compared with today's websites, it was very basic and contained mostly text.
As browser technology evolved, support for images, multimedia, scripting, and styling was
added.
HTML (1991)
CSS (1996)
Introduced to separate presentation from structure, allowing developers to control colors, fonts,
spacing, and layouts.
JavaScript (1995)
Added interactivity, enabling features such as form validation, animations, and dynamic content
updates.
Together, these technologies remain the foundation of modern front-end web development.
1.2.12 Web 1.0
Web 1.0 refers to the early stage of the Web.
Characteristics:
Examples included simple company websites, personal pages, and online documentation.
Characteristics:
● Social media
● Blogs
● Online collaboration
● User-generated content
● Interactive applications
Examples:
● Decentralized technologies
● Greater user control over data
● Blockchain-based applications
● Artificial intelligence integration
● Semantic understanding of information
While some Web 3.0 technologies are already in use, others are still evolving.
Key Terms
● ARPANET: The first large-scale packet-switched network.
● Packet Switching: Dividing data into small packets for transmission.
● TCP/IP: The standard protocol suite used on the Internet.
● DNS: System that translates domain names into IP addresses.
● World Wide Web: A service that allows users to access linked web documents.
● HTML: HyperText Markup Language.
● HTTP: HyperText Transfer Protocol.
● URL: Uniform Resource Locator.
Review Questions
1. Why was ARPANET created?
2. What is packet switching, and why is it important?
3. What roles do TCP and IP perform?
4. Why is January 1, 1983 considered a significant date in Internet history?
5. What problem does DNS solve?
6. What three technologies did Tim Berners-Lee introduce?
7. Compare Web 1.0, Web 2.0, and Web 3.0.
8. Why are HTML, CSS, and JavaScript considered the core technologies of the Web?
Practical Exercise
Create a timeline of Internet history from 1969 to the present. For each milestone:
Learning Objectives
After completing this section, you will be able to:
The Internet is the infrastructure. The World Wide Web is one service that
runs on that infrastructure.
Think of the Internet as a vast road network and the Web as one type of vehicle traveling on
those roads.
Examples include:
● Websites
● Email
● Video calls
● Online gaming
● Cloud storage
● File transfers
● Streaming services
● Messaging applications
The Internet itself does not display web pages. It simply provides the communication network
over which data is transmitted.
Without the Internet, the Web cannot function. Likewise, the Internet can still exist without the
Web because it supports many other services.
Includes routers, cables, servers, Includes browsers, web servers, HTML, CSS,
ISPs JavaScript
In this analogy:
The roads make transportation possible, but they are not the vehicles themselves.
Common protocols:
● SMTP
● IMAP
● POP3
Examples:
● Gmail
● Outlook
● Yahoo Mail
File Transfer
Common protocols:
● FTP
● SFTP
Examples:
Examples:
● Zoom
● Microsoft Teams
● Google Meet
These services use the Internet but are not part of the World Wide Web itself.
Online Gaming
Multiplayer games exchange data continuously between players and game servers.
Examples:
● Minecraft
● Fortnite
● Valorant
Cloud Storage
Examples:
● Google Drive
● Dropbox
● OneDrive
Streaming Services
Examples:
● YouTube
● Netflix
● Spotify
User
│
▼
Web Browser
│
▼
DNS Lookup
│
▼
Web Server
│
▼
HTML, CSS, JavaScript
│
▼
Rendered Web Page
Step 1
Example:
[Link]
Step 2
Step 3
Step 5
● HTML
● CSS
● JavaScript
● Images
● Fonts
● Videos (if requested)
Step 6
● Google Chrome
● Mozilla Firefox
● Microsoft Edge
● Safari
● Brave
Responsibilities of a browser:
A web server may also run application code (such as [Link], PHP, Python, or Java) to
generate dynamic content before sending it to the browser.
1.3.10 URLs
A Uniform Resource Locator (URL) identifies the location of a resource on the Web.
Example:
[Link]
Components:
HTTP
HTTPS
Incorrect.
Incorrect.
Wi-Fi is a wireless technology that connects devices to a local network. It usually provides
access to the Internet but is not the Internet itself.
"The Web is the Internet."
Incorrect.
The Web is only one service that operates over the Internet.
Understanding the distinction between the Internet and the Web helps you understand:
This knowledge becomes essential when working with web hosting, APIs, performance
optimization, and debugging.
Key Terms
● Internet: Global network infrastructure.
● World Wide Web (WWW): Collection of interconnected web pages.
● Browser: Software used to access web pages.
● Web Server: Computer or software that serves web content.
● URL: Address of a web resource.
● HTTP: Protocol for transferring web resources.
● HTTPS: Secure version of HTTP.
● DNS: System that converts domain names into IP addresses.
Review Questions
1. What is the difference between the Internet and the World Wide Web?
2. Name five Internet services besides the Web.
3. What is the purpose of a web browser?
4. What does a web server do?
5. What are the main parts of a URL?
6. Why is HTTPS preferred over HTTP?
7. Why can the Internet exist without the Web?
Practical Exercise
1. Open your browser and visit three different websites.
2. Write down the full URL for each.
3. Identify the protocol (http or https), the domain, and the path.
4. Explain, in your own words, how your browser retrieves each web page.
Prerequisites:
1.4.1 Introduction
Opening a website seems simple.
You type a web address into your browser, press Enter, and within seconds the webpage
appears.
For example:
[Link]
Behind the scenes, however, dozens of operations occur in less than a second.
User
│
▼
Browser
│
▼
DNS Lookup
│
▼
Internet
│
▼
Web Server
│
▼
HTTP Response
│
▼
Browser Rendering
│
▼
Web Page Displayed
[Link]
A URL (Uniform Resource Locator) tells the browser which resource to request.
https Protocol
www Subdomain
[Link] Domain
/products/laptop Path
id=10 Query
Parameter
● HTML
● CSS
● JavaScript
● Images
● Fonts
Benefits:
● Faster loading
● Less Internet traffic
● Reduced server workload
It needs an IP address.
Example:
[Link]
[Link]
Without DNS, users would need to remember numerical addresses for every website.
● TCP connection
● TLS encryption
● Secure communication
Example:
GET / HTTP/1.1
Host: [Link]
The browser is asking:
● Browser name
● Supported languages
● Cookies
● Accepted file formats
Example:
Browser
Server
Database
Generated HTML
Example:
HTTP/1.1 200 OK
● HTML
● CSS references
● JavaScript references
● Images
● Metadata
Code Meaning
200 Success
Example:
<!DOCTYPE html>
<html>
<head>
<title>My Website</title>
</head>
<body>
<h1>Hello World</h1>
</body>
</html>
The browser understands the document structure and prepares to display it.
Example HTML:
<body>
<h1>Hello</h1>
<p>Welcome</p>
</body>
DOM Tree:
Document
│
└── html
│
├── head
│
└── body
│
├── h1
│
└── p
JavaScript interacts with this DOM tree to update content, respond to user actions, and modify
the page dynamically.
CSS controls:
● Colors
● Fonts
● Margins
● Layout
● Animations
<script src="[Link]"></script>
● Form validation
● Navigation menus
● Image sliders
● Search functionality
● Interactive maps
<img src="[Link]">
● Images
● Videos
● Fonts
● Icons
● PDFs
● HTML
● CSS
● JavaScript
Examples:
● Personal portfolio
● Company brochure site
● Documentation
Advantages:
● Fast
● Simple
● Secure
Dynamic Website
Characteristics:
Examples:
● Facebook
● Amazon
● Gmail
● Online banking
Advantages:
● Interactive
● User accounts
● Real-time updates
Real-World Example
Imagine you open YouTube.
Even a single page may involve hundreds of network requests for images, fonts, scripts, and
other assets.
Common Mistakes
Misconception 1
Incorrect.
Misconception 2
Incorrect.
HTML provides structure. CSS and JavaScript are usually separate files that the browser
requests after loading the HTML.
Misconception 3
Incorrect.
Resources are loaded in stages. Some content may appear before images or scripts have
finished downloading.
Key Terms
● Browser: Software used to access websites.
● URL: Address of a web resource.
● DNS: Converts domain names into IP addresses.
● HTTP Request: Message sent by the browser to request a resource.
● HTTP Response: Server's reply containing the requested resource.
● DOM: Tree representation of an HTML document.
● CSSOM: Tree representation of CSS rules.
● Render Tree: Combined structure used for layout and painting.
● Static Website: Delivers pre-built pages.
● Dynamic Website: Generates pages dynamically, often using databases.
Review Questions
1. What is the first thing a browser does after you enter a URL?
2. Why is DNS necessary?
3. What is the purpose of an HTTP request?
4. What information does an HTTP response contain?
5. What is the DOM?
6. Why does the browser make additional requests for CSS and JavaScript?
7. Compare static and dynamic websites.
Practical Exercise
1. Open a website in Google Chrome.
2. Press F12 to open Developer Tools.
3. Go to the Network tab.
4. Reload the page.
5. Observe:
○ Number of requests
○ HTML document request
○ CSS files
○ JavaScript files
○ Images
○ Fonts
○ Response status codes (200, 304, etc.)
Write a short report explaining the order in which resources were loaded and identify which files
contributed to the page's appearance and functionality.
Prerequisites:
Learning Objectives
After completing this section, you will be able to:
1.5.1 Introduction
Almost every website and web application you use follows the client–server model.
When you browse an online store, send a message, or watch a video, your device requests
information from another computer that stores and processes the data.
● Sending requests
● Displaying responses
● Collecting user input
● Executing some application logic (especially in modern web apps)
Example:
User
│
▼
Chrome Browser
Servers can:
● Store websites
● Process user requests
● Run application logic
● Access databases
● Authenticate users
● Deliver files
● Send emails
Unlike personal computers, servers are designed to operate continuously and handle many
client requests simultaneously.
Example:
Client
│
Request
▼
Web Server
Client
│
HTTP Request
▼
Server
│
HTTP Response
▼
Client
Example:
GET /search?q=html+tutorial
Step 1
/products
Step 2
Step 3
Step 4
Step 5
Flow:
Browser
Web Server
↓
Database
Web Server
Browser
Example:
Request 1
Open Homepage
Request 2
Open Profile
● Cookies
● Sessions
● Tokens
Examples:
● Apache
● Nginx
● IIS
Application Server
Examples:
● [Link]
● Django
● Laravel
● [Link]
● Spring Boot
Database Server
Examples:
● MySQL
● PostgreSQL
● MongoDB
● SQL Server
File Server
Mail Server
● User accounts
● Products
● Orders
● Messages
● Comments
● Blog posts
Example:
Users Table
ID
Name
Password
Technologies:
● HTML
● CSS
● JavaScript
Responsibilities:
● Display pages
● User interaction
● Form validation
● Animations
Back-End
Languages include:
● JavaScript ([Link])
● Python
● PHP
● Java
● C#
● Go
Responsibilities:
● Business logic
● Authentication
● Database operations
● API development
● Security
Instead of returning an HTML page, an API often returns structured data, commonly in JSON
format.
Example:
{
"name": "Laptop",
"price": 1200
}
Presentation Layer
(Browser)
Application Layer
(Server)
Data Layer
(Database)
Presentation Layer
Application Layer
Data Layer
Client:
Server:
Database:
Workflow:
Browser
↓
Google Server
Database
Recipient
The user interacts only with the client, while the server handles processing, storage, and
delivery.
Incorrect.
The browser temporarily stores downloaded resources and requests additional data from the
server as needed.
Not necessarily.
● Load balancers
● Web servers
● Application servers
● Database servers
● Cache servers
● File storage services
Best Practices
● Separate front-end and back-end responsibilities.
● Validate user input on both client and server.
● Keep APIs well documented.
● Protect sensitive data with HTTPS.
● Use authentication and authorization mechanisms.
● Optimize database queries for performance.
Key Terms
● Client: Device or application requesting services.
● Server: Computer or software providing services.
● HTTP: Protocol used for client–server communication.
● Request: Message sent by the client.
● Response: Message returned by the server.
● Database: Organized collection of data.
● API: Interface for communication between software systems.
● Three-Tier Architecture: Separation into presentation, application, and data layers.
Review Questions
1. What is the difference between a client and a server?
2. Describe the request–response model.
3. Why is HTTP considered stateless?
4. What is the role of a database in a web application?
5. Compare front-end and back-end development.
6. What is an API, and why is it useful?
7. What are the three layers of a three-tier architecture?
Practical Exercise
Imagine you are designing an online library system.
Identify:
● The client(s)
● The web server
● The application server
● The database
● Three types of requests users might make (e.g., search for a book, borrow a book, view
account details)