Computer4U logo
Plus Two Computer Science · Chapter 04

Web Technology

13 sections
Live HTML compiler
14 review questions
4.1

Communication on the Web

4.1

Web Communication

The browser request starts with a URL going to a DNS server to resolve an IP address; the browser then connects to that address, and the web server sends back the requested page. All of this rides on TCP/IP — TCP breaks data into packets, IP routes them to their destination.
Two kinds of communication happen on the web: client-to-server and server-to-server.

Plain browsing needs no authentication, but anything sensitive — banking logins, payments — is encrypted with HTTPS, which layers SSL (Secure Sockets Layer) on top of HTTP. The server presents an SSL certificate, the browser verifies it with a certification authority, and only then does the encrypted session begin.
Server-to-server communication (e.g. a shopping site talking to a bank) works similarly, often routed through a payment gateway that bridges merchant and bank servers securely.

4.2

Web Server Technologies

4.2

Web Server

A web server is both a powerful, always-on computer and the software installed on it (Apache, IIS, nginx, GWS) that delivers pages on request over HTTP. These machines usually placed in a data center — having the facilities like backup power, cooling, and high-speed networking.

Every service on a server is reached through a numbered software port

Default Port No. Service
20 & 21 File Transfer Protocol (FTP)
22 Secure Shell (SSH)
25 Simple Mail Transfer Protocol (SMTP)
53 Domain Name System (DNS) service
80 Hypertext Transfer Protocol (HTTP)
110 Post Office Protocol (POP3)
443 HTTP Secure (HTTPS)

A DNS server resolves a domain name to an IP address, checking first the browser's own cache, then the OS cache, then the ISP's DNS, and finally a recursive search starting from one of the 13 global root servers if nowhere else has the answer.

4.3–4.6

Web Design, Static/Dynamic Pages, Scripts & CSS

4.3

Web Designing

Beyond a plain text editor, dedicated tools like Bluefish, Dreamweaver, and Adobe/Microsoft Expression Web let designers build and link pages visually, and often bundle in FTP upload for publishing directly to a server.

4.4

Static and Dynamic Web Pages

Table 4.2: Comparison of static and dynamic web pages
Static web page Dynamic web page
The content and layout of a web page is fixed. The content and layout may change during run time.
Static web pages never use databases. Database is used to generate dynamic content through queries.
Static web pages directly run on the browser and do not require any server side application program. Dynamic web page runs on the server side application program and displays the results.
Static web pages are easy to develop. Dynamic web page development requires programming skills.

4.5

Scripts

A script is program code embedded in a page via <SCRIPT>.
Scripts are of two kinds:
client-side (JavaScript, VBScript) runs in the browser.
server-side (PHP, ASP, JSP) runs on the server and returns plain HTML.

JavaScript — client-sideVBScript — mostly server-side (IIS)PHP — server-side, .phpASP — server-side, .aspJSP — server-side, .jsp

Ajax fetch data in the background without a full reload.

4.6

Cascading Style Sheet (CSS)

CSS separates a page's content (HTML) from its presentation (colours, fonts, spacing, layout). It can be applied three ways: inline (a style attribute on one tag), embedded (inside <HEAD>), or linked (an external .css file) — linked CSS is the most reusable, since editing one file restyles every page that links to it.

4.7–4.9

HTML Fundamentals

4.7

Basic Concepts of HTML Documents

Every HTML file is built from tags (the commands) and attributes (extra parameters on a tag).
Container tags: Tags that need both an opening and closing tags. Eg:- <HTML>...</HTML>
Empty tags: Tags with no closing tag Eg:-<BR> or <IMG>.
A tag pair plus everything between them is called an element. HTML itself is not case-sensitive.

<HTML>
<HEAD>
<TITLE>This is the title of web page</TITLE>
</HEAD>
<BODY>
Hello, Welcome to the world of web pages!
</BODY>
</HTML>

4.8

Creating an HTML Document

Any plain text editor (Geany, Notepad, Notepad++) can write HTML — the file just needs to be saved with a .html or .htm extension, then opened in a browser to view it.

4.9

Essential HTML Tags

The four tags every page needs: <HTML> (wraps the whole document; Dir for text direction, Lang for language), <HEAD> (metadata section), <TITLE> (browser tab text), and <BODY> (the visible content — with attributes like Bgcolor, Background, Text, Link/Alink/Vlink for hyperlink colours, and Leftmargin/Topmargin).

4.10–4.13

Formatting Tags, Entities, Comments & Images

4.10

Some Common Tags

Headings <H1>–<H6> scale from biggest to smallest. <P> makes paragraphs (collapsing extra spaces/lines automatically); <BR> forces a single line break without starting a new paragraph; <HR> draws a horizontal rule. Text styling tags include <B>, <I>, <U>, <S>/<STRIKE>, <BIG>, <SMALL>, <STRONG>, <EM>, and <SUB>/<SUP> for subscripts and superscripts. <BLOCKQUOTE> indents a long quotation, <Q> handles a short inline one. <PRE> preserves whitespace and line breaks exactly as typed; <MARQUEE> scrolls content; <DIV> groups a block for styling; <FONT> sets size/colour/face for a text span; <CENTER> centres its content.

<H1 Align="left">This is a Heading type 1</H1>
<P Align="justify">A justified paragraph...</P>
<B><I><U>Bold, italic and underlined</U></I></B>
H<SUB>2</SUB>O   (a+b)<SUP>2</SUP>
4.11

HTML Entities for Reserved Characters

Characters like < and > are part of HTML's own syntax, so typing them literally would confuse the browser. HTML entities (e.g. &lt; for <, &gt; for >) let these reserved characters appear as visible text instead.

4.12

Adding Comments in HTML Document

Comments (<!-- like this -->) document the code for other readers without affecting what the browser displays — good practice in any document beyond the simplest.

4.13

Inserting Images

<IMG> is an empty tag whose main attribute, Src, points to the image file. Other attributes control Height/Width, Border thickness, Align (how text wraps around it), and Alt — fallback text shown if the image fails to load, and read aloud by screen readers.

<IMG Src="book3.jpg" Height="50" Width="70" Border="5" Alt="A stack of books">
Try It Yourself

Live HTML Compiler

Edit the code on the left and press Run to see the result on the right — try out the tags from this chapter directly.

index.html
Self-Assessment

Question & Answer Review

Tap a question to reveal the answer — a quick way to check understanding before moving to Chapter 5.

01What does HTTPS add on top of HTTP, and why?
HTTPS layers SSL (Secure Sockets Layer) encryption on top of HTTP, so sensitive data like usernames and passwords aren't sent as readable plain text and can't easily be intercepted by hackers.
02What is a software port, and why are they numbered?
A 16-bit number that, combined with a server's IP address, identifies a specific service running on that server — e.g. port 80 for HTTP, 443 for HTTPS, 21 for FTP — so one machine can offer many services at once.
03How does a browser resolve a domain name to an IP address?
It checks its own cache first, then the operating system's cache, then the local ISP's DNS server; if still not found, the ISP's DNS server runs a recursive search starting from one of the global root servers.
04What's the difference between a static and a dynamic web page?
A static page's content stays the same until someone edits the code manually. A dynamic page runs server-side code on each visit — often querying a database — to build a page tailored to that specific request.
05What's the difference between client-side and server-side scripting?
Client-side scripts (JavaScript, VBScript) run in the browser — fast, but users can disable them. Server-side scripts (PHP, ASP, JSP) run on the server and send back plain HTML, so they can't be blocked but add load to the server.
06Why should form validation usually happen on the client side rather than the server?
Checking on the client gives instant feedback without a round trip across the Internet, and avoids adding unnecessary load and network traffic to an already busy server.
07What are the three ways to implement CSS?
Inline (a style attribute on one tag), embedded (inside the page's HEAD section), and linked (an external .css file referenced by the page) — linked CSS is the most reusable across many pages.
08What is the difference between a container tag and an empty tag?
A container tag needs both an opening and a closing tag, wrapping content between them (e.g. <BODY>...</BODY>). An empty tag has no content to wrap and needs no closing tag (e.g. <BR>, <IMG>).
09What are the four essential tag pairs every HTML document needs?
<HTML>, <HEAD>, <TITLE>, and <BODY> — HTML wraps the whole document, HEAD holds metadata like the title, TITLE sets the browser tab text, and BODY holds the visible page content.
10What's the difference between the <P> and <BR> tags?
<P> starts a new paragraph, with a blank line added before it. <BR> just breaks the current line and continues immediately on the next line, without adding paragraph spacing.
11Why do HTML entities exist?
Characters like < and > are part of HTML's own syntax, so typing them literally would be read as a tag. HTML entities (like &lt; for <) let these reserved characters be displayed as ordinary text.
12What is the purpose of the Alt attribute on the <IMG> tag?
It provides fallback text shown if the image fails to load, and is read aloud by screen readers — making the page accessible even when the image itself isn't available.
13What's the difference between the <B> tag and the <STRONG> tag?
Visually they look the same — both render bold. But <STRONG> is a phrase tag meant to mark text as semantically important, while <B> is purely a stylistic instruction with no added meaning.
14What does a payment gateway do in an online transaction?
It acts as a secure bridge between a merchant's web server and a bank's web server, transferring payment data in encrypted form during an online purchase or money transfer.