Docsity

Web Development: HTTP, HTML, CSS and JavaScript Fundamentals, Study notes of Web Application Development

Toggle sidebar
bg1
Web Development: HTTP, HTML, CSS and JavaScript Fundamentals Page 1 of 3
Web Development: HTTP, HTML, CSS and JavaScript
Fundamentals
How a request becomes a page, and what makes the page accessible and safe
Computer Science | Undergraduate (Level 4) | December 2026
WHAT IS INSIDE
1. The request-response cycle
2. HTML: structure and accessibility
3. CSS: the cascade and layout
4. JavaScript, the DOM and security
Exam question patterns
Glossary of exam-ready definitions
1. The request-response cycle
A browser resolves a URL to an IP address through DNS, opens a TCP connection (with TLS for
HTTPS), and sends an HTTP request with a method, path, headers and optional body. The server
responds with a status code, headers and body. The status classes are worth memorising: 2xx success,
3xx redirection, 4xx client error, 5xx server error. GET is safe and idempotent, POST creates and is
neither, PUT replaces and is idempotent, PATCH amends, DELETE removes.
Cookies carry state over a stateless protocol; HTTP/2 multiplexes many requests over one connection
and HTTP/3 runs over QUIC. Caching is decided by headers such as Cache-Control, ETag and
Last-Modified, and understanding it explains most 'why am I seeing an old version' questions. The
critical rendering path - HTML parsed into the DOM, CSS into the CSSOM, combined into the
render tree, then layout and paint - determines what blocks first paint.
•Idempotent - repeating the request has the same effect; GET, PUT and DELETE qualify, POST does
not.
•Same-origin policy - a page may read only resources from the same scheme, host and port.
•CORS - controlled relaxation of the same-origin policy using response headers.
•Render-blocking - stylesheets and synchronous scripts delay first paint; defer or load asynchronously.
2. HTML: structure and accessibility
HTML describes meaning, not appearance. A semantic document uses header, nav, main, article,
section and footer rather than generic containers, which helps assistive technology, search engines and
future maintainers. Headings form a hierarchy: one h1 per page and no skipped levels. Lists, tables and
forms each have elements that carry the meaning; a table is for tabular data, never for layout.
Accessibility follows the WCAG principles - perceivable, operable, understandable, robust. In practice
that means text alternatives on images, labels tied to inputs, sufficient colour contrast, keyboard
operability, visible focus and correct landmarks. ARIA attributes can add semantics but the first rule of
ARIA is not to use it when a native element already carries the meaning. Forms need label for,
appropriate input type for mobile keyboards, and error messages announced to screen readers.
•Alt text - describe purpose, not appearance; empty alt for decorative images.
•Form validation - client-side for usability, server-side for security.
pf3

Partial preview of the text

Download Web Development: HTTP, HTML, CSS and JavaScript Fundamentals and more Study notes Web Application Development in PDF only on Docsity!

Web Development: HTTP, HTML, CSS and JavaScript

Fundamentals

How a request becomes a page, and what makes the page accessible and safe Computer Science | Undergraduate (Level 4) | December 2026

WHAT IS INSIDE

  1. The request-response cycle
  2. HTML: structure and accessibility
  3. CSS: the cascade and layout
  4. JavaScript, the DOM and security Exam question patterns Glossary of exam-ready definitions 1. The request-response cycle

A browser resolves a URL to an IP address through DNS , opens a TCP connection (with TLS for HTTPS), and sends an HTTP request with a method, path, headers and optional body. The server responds with a status code , headers and body. The status classes are worth memorising: 2xx success, 3xx redirection, 4xx client error, 5xx server error. GET is safe and idempotent, POST creates and is neither, PUT replaces and is idempotent, PATCH amends, DELETE removes.

Cookies carry state over a stateless protocol; HTTP/2 multiplexes many requests over one connection and HTTP/3 runs over QUIC. Caching is decided by headers such as Cache-Control , ETag and Last-Modified , and understanding it explains most 'why am I seeing an old version' questions. The critical rendering path - HTML parsed into the DOM , CSS into the CSSOM , combined into the render tree, then layout and paint - determines what blocks first paint.

  • Idempotent - repeating the request has the same effect; GET, PUT and DELETE qualify, POST does not.
  • Same-origin policy - a page may read only resources from the same scheme, host and port.
  • CORS - controlled relaxation of the same-origin policy using response headers.
  • Render-blocking - stylesheets and synchronous scripts delay first paint; defer or load asynchronously. 2. HTML: structure and accessibility

HTML describes meaning , not appearance. A semantic document uses header , nav , main , article , section and footer rather than generic containers, which helps assistive technology, search engines and future maintainers. Headings form a hierarchy: one h1 per page and no skipped levels. Lists, tables and forms each have elements that carry the meaning; a table is for tabular data, never for layout.

Accessibility follows the WCAG principles - perceivable, operable, understandable, robust. In practice that means text alternatives on images, labels tied to inputs, sufficient colour contrast, keyboard operability, visible focus and correct landmarks. ARIA attributes can add semantics but the first rule of ARIA is not to use it when a native element already carries the meaning. Forms need label for , appropriate input type for mobile keyboards, and error messages announced to screen readers.

  • Alt text - describe purpose, not appearance; empty alt for decorative images.
  • Form validation - client-side for usability, server-side for security.

Web Development: HTTP, HTML, CSS and JavaScript Fundamentals

  • Landmarks - header, nav, main and footer allow quick navigation with a screen reader.
  • Progressive enhancement - content and function work without JavaScript, then improve. 3. CSS: the cascade and layout

CSS resolves conflicts by cascade : importance, then specificity, then source order. Specificity is scored by inline styles, IDs, classes and attributes, then elements; !important overrides normal declarations but should be a last resort. The box model - content, padding, border, margin - determines size, with box-sizing: border-box making width include padding and border. Inheritance carries text properties down, which is why a font set on the body applies everywhere unless overridden.

Flexbox lays out in one dimension and handles alignment and distribution along a main axis. Grid lays out in two dimensions with explicit rows and columns, and is the right tool for page structure. Media queries and fluid units support responsive design, and the mobile-first approach starts with the smallest screen and adds complexity upward. Custom properties make theming possible, and normal flow should be understood before either layout module is used.

  • Specificity - ID (100) beats class (10) beats element (1); equal specificity resolves by order.
  • Flex versus grid - one dimension versus two; grid for layout, flex for components.
  • Responsive unit - rem relative to root font size, vh and vw relative to viewport.
  • Reflow versus repaint - layout change versus colour change; the first is more expensive. 4. JavaScript, the DOM and security

JavaScript is single-threaded with an event loop : synchronous code runs to completion, then the microtask queue (promises) drains, then the task queue. The DOM is a tree of nodes; querySelector selects, addEventListener responds, and event bubbling allows delegation from a parent. fetch returns a promise; async/await is syntactic sugar that makes asynchronous code read sequentially, with errors handled by try/catch.

Security is a client responsibility as well as a server one. XSS injects executable script; the defence is output encoding and a strict Content Security Policy , not blocklisting characters. CSRF makes a logged-in browser send a forged request; the defence is a synchroniser token or SameSite cookies. SQL injection is prevented by parameterised queries. Storing secrets in client code is never safe, and authentication state must be validated on the server for every request.

  • Event delegation - one listener on a parent handles children via event.target.
  • Promise states - pending, fulfilled, rejected; a rejected promise without a handler breaks the chain.
  • XSS versus CSRF - injected script versus forged authenticated request.
  • Progressive enhancement - meaningful content without script, enhanced behaviour with it. Method Purpose Safe Idempotent GET Retrieve a resource Yes Yes POST Create a resource or submit data No No PUT Replace a resource No Yes PATCH Partially modify a resource No No DELETE Remove a resource No Yes

For an HTTP question, state the method, the expected status code and one security consequence. That single sentence structure answers most short-answer questions on the topic.