Smart Syllabus 2027: some topics of this unit are removed — study the full chapter, but check the official PECTAA smart syllabus for the 2027 paper.
Web development means building websites that people can open in a browser. A web page has three main parts: HTML gives it structure, CSS gives it style and colour, and JavaScript makes it interactive. In this chapter we learn the basic tags of HTML, the basic properties of CSS, and the basic ideas of JavaScript.
A website is made of web pages, and each page is a file that a browser opens and displays. HTML, which stands for HyperText Markup Language, is the language used to create the structure and content of a web page. It uses tags to mark different parts of the page, such as headings, paragraphs, links, and images. An HTML document starts with <html> and contains two main parts: the <head> section, which holds information about the page such as its title, and the <body> section, which holds the content shown to the user. The title is written inside the <title> tag in the head section, and it appears in the browser tab.
The most common HTML tags are easy to learn. Headings are made with <h1> to <h6>, where <h1> is the largest and <h6> is the smallest. A paragraph is made with the <p> tag. A link is made with the <a> tag and the href attribute, for example <a href="https://example.com">Visit</a>. An image is added with the <img> tag, which uses the src attribute for the image address and the alt attribute for text shown if the image cannot load. A list with bullets is made with <ul>, and a numbered list is made with <ol>, with each item inside <li>. Some tags, such as <p> and <h1>, need a closing tag, while <img> does not need one.
CSS stands for Cascading Style Sheets. It is used to control how a web page looks, including colours, fonts, sizes, spacing, and layout. Without CSS, a page looks plain. A CSS rule has three parts: a selector, a property, and a value. For example, in p { color: blue; }, p is the selector, color is the property, and blue is the value. Common properties are color for text colour, background-color for background colour, font-size for the size of text, font-family for the type of font, and text-align for the alignment of text. CSS can be written inside the <style> tag in the head section of an HTML page, which is called internal CSS, or in a separate file, which is called external CSS.
JavaScript is a programming language that makes a web page interactive. With JavaScript, a page can respond when a user clicks a button, types in a form, or moves the mouse. A variable is used to store a value, and it is created with let or const, for example let name = "Ali";. A function is a block of code that runs when it is called, for example when a button is clicked. To change something on a page, JavaScript first selects an HTML element, often with document.getElementById("id"), and then changes its text or style. JavaScript code is usually written inside a <script> tag at the end of the body section of an HTML page.
A simple web page combines all three languages. HTML gives the structure, such as a heading, a paragraph, and a button. CSS gives the style, such as the colour and size of the heading and the button. JavaScript gives the action, such as showing a message when the button is clicked. For example, a button can call a JavaScript function that changes the text of a paragraph. This is how real websites work: the three languages work together on every page. When building a page, it is good practice to keep the structure, style, and code tidy so the page is easy to read and easy to fix.
Good web pages are easy to read, easy to use, and work well on different screen sizes. Headings should be used in order, from <h1> down, and every image should have an alt text so the page is useful even when the image does not load. Links should have clear text that tells the user where the link goes. Colours should be easy to read, with good contrast between text and background. Comments in HTML, written as <!-- comment -->, are not shown on the page and are used to explain the code to other people who read it.
| Term | Definition |
|---|---|
| HTML | The standard language used to create the structure and content of a web page, using elements written with tags. |
| CSS | A language used to control the style and appearance of a web page, such as colours, fonts, spacing, and layout. |
| JavaScript | A programming language used to make web pages interactive, for example by responding to a button click or checking a form. |
| Tag | A word or symbol in angle brackets, such as <p> or <h1>, used to mark the start or end of an HTML element. |
| Attribute | Extra information added to an HTML tag, for example href in <a href="https://example.com">, which gives the link address. |
| Body | The part of an HTML document that contains the content shown to the user, such as headings, paragraphs, images, and links. |
| Hyperlink | An HTML element used to create a clickable link to another page or website, written with the <a> tag and the href attribute. |
1. What does HTML stand for?
Answer: A — HyperText Markup Language. HTML stands for HyperText Markup Language.
2. CSS is used to:
Answer: C — Style a web page. CSS is used to control the style, colours, fonts, and layout of a web page.
3. Which language is used to make a web page interactive?
Answer: B — JavaScript. JavaScript adds interactivity, such as responding to clicks and checking forms.
4. Which tag is used to create a paragraph?
Answer: D — <p>. The <p> tag creates a paragraph.
5. Which is the largest heading tag in HTML?
Answer: A — <h1>. <h1> is the largest heading tag and <h6> is the smallest.
6. Which tag is used to create a hyperlink?
Answer: C — <a href>. The <a> tag with the href attribute creates a link to another page or website.
7. Which CSS property sets the colour of text?
Answer: B — color. The color property in CSS sets the colour of text.
8. Which is the correct way to add an image in HTML?
Answer: A — <img src="photo.jpg" alt="A photo">. The src attribute gives the address of the image file, and alt gives text if the image does not load.
9. Which keyword is used to declare a variable in JavaScript?
Answer: C — let. In JavaScript, let and const are used to declare a variable.
10. Which JavaScript code selects an element by its id?
Answer: B — document.getElementById(). document.getElementById() selects the HTML element with the given id.
1. What is HTML? What is it used for?
HTML stands for HyperText Markup Language. It is used to create the structure and content of a web page, using tags for headings, paragraphs, links, images, and lists.
2. What is CSS? What is it used for?
CSS stands for Cascading Style Sheets. It is used to control the appearance of a web page, such as colours, fonts, text size, spacing, and layout. A CSS rule has a selector, a property, and a value.
3. What is a hyperlink? How is it created in HTML?
A hyperlink is a clickable link that takes the user to another page or website. It is created with the <a> tag and the href attribute, for example <a href="https://example.com">Visit Website</a>.
4. Which CSS properties are used to set text colour and background colour? Give an example.
In CSS, the color property sets the colour of text and the background-color property sets the background colour. For example, p { color: blue; background-color: yellow; } makes paragraph text blue on a yellow background.
5. What is JavaScript? Give one example of what it can do on a web page.
JavaScript is a programming language used to make web pages interactive. For example, it can show a message when a button is clicked, check a form before it is sent, or change the text on a page. It is written inside a <script> tag.
HTML gives a web page its structure, CSS gives it style, and JavaScript makes it interactive. Headings, paragraphs, links, images, and lists are made with HTML tags, while colour, font size, and layout are controlled with CSS properties. JavaScript uses variables and functions to respond to the user, for example when a button is clicked. Together, the three languages make a complete and useful web page.