Home / Notes / Class 12 / Computer Science / Web development
How the web works, web browsers and servers, URLs, HTML structure and tags, links, images, lists and tables, forms, CSS styling, the role of JavaScript, and website planning and publishing.
The internet is the global network. The World Wide Web is a collection of web pages linked together and served over the internet using HTTP or HTTPS. A web page is one document. A website is a group of related pages under one domain name. A web browser such as Chrome or Firefox requests pages and displays them.
When you type a URL, the browser asks DNS for the IP address, sends an HTTP request to the web server, and the server sends back the page, usually HTML with CSS, JavaScript and images. The browser then draws the page. This is the client-server model. HTTPS adds encryption so that data cannot be read on the way.
A URL has parts: the protocol (https), the domain name (www.example.com), and the path to the page (/notes/page.html). Static pages are the same for every visitor, while dynamic pages are made by a server program using a database and can change for each user.
HTML (HyperText Markup Language) describes the structure of a page using tags. Most tags come in pairs: an opening tag <p> and a closing tag </p>. Some, such as <br> and <img>, are empty tags. Tags can have attributes written as name="value", for example <a href="page.html">.
Basic structure of an HTML page:
Common tags:
Lists and tables:
A form collects input from the visitor. The <form> tag has an action (where the data goes) and a method (GET or POST). Inside it, <input type="text">, <input type="password">, radio buttons, checkboxes, <select> for a drop-down list, <textarea> for long text and a submit button are used. GET puts data in the URL, so POST is used for passwords and large data.
CSS (Cascading Style Sheets) controls the look of a page: colours, fonts, spacing and layout. A rule has a selector and declarations: p { color: blue; font-size: 16px; }. CSS can be inline (the style attribute), internal (a <style> tag in the head) or external (a separate .css file linked with <link rel="stylesheet" href="style.css">). External CSS is best because one file styles many pages.
JavaScript is a programming language that runs in the browser and makes pages interactive, for example checking a form before sending or showing a message when a button is clicked. HTML gives structure, CSS gives style and JavaScript gives behaviour.
Planning a website: decide its purpose and audience, draw a site map and page layouts, write the content, build the pages, test them in different browsers and on a phone, and publish. Good design is simple, readable, easy to navigate and works on small screens (responsive design).
To publish, a website is uploaded to a web hosting server and a domain name is registered. Pages are checked for broken links and slow images. Copyright of text and pictures must be respected.
Study tip: Practise writing a full small page from memory: doctype, html, head with title, and body with a heading, paragraph, link, image, list and table. Check that every opening tag has its closing tag and all attribute values are in quotes.
Say the meaning first, then open the card to check.
The markup language that gives structure to web pages.
A keyword in angle brackets that tells the browser how to show content.
Extra information inside a tag, written as name="value".
A link that takes the visitor to another page or place.
A language used to style the look of HTML pages.
The full web address of a resource.
A computer that stores websites and sends pages when asked.
The readable name of a website such as example.com.
Software that requests, receives and displays web pages.
These are the kind of questions asked for 2, 3 and 5 marks. Try each one before opening the answer.
A web page is a single document written in HTML and shown in the browser. A website is a collection of related web pages joined by links and kept under one domain name, such as a school site with pages for admission, news and contact.
The alt attribute gives a short text description of the image. It is shown if the image does not load, helps search engines and is read aloud to visually impaired users.
<ol> <li>Mango</li> <li>Apple</li> <li>Orange</li> </ol> The ol tag makes a numbered list and each li tag is one item. The browser numbers them 1, 2, 3.
Inline CSS uses the style attribute on one tag and affects only that tag. Internal CSS is written inside a style tag in the head and affects that page. External CSS is stored in a separate .css file linked in the head, and can style many pages at once, so it is easiest to maintain.
The browser takes the domain name from the URL and asks a DNS server for its IP address. It then sends an HTTP request to that web server. The server finds the requested file, or builds a page using a program and database, and sends back a response with HTML. The browser reads the HTML, loads the linked CSS, images and JavaScript, and displays the page. This is the client-server model.
GET appends form data to the URL, so it is visible and limited in length. It suits searches. POST sends the data in the body of the request, hiding it from the address bar and allowing larger data. It suits passwords and registration forms.