SENG1050 Chap.2 URIs and HTML Document Structure
URIs and HTML Document Structure
This chapter covers the Week 2 lecture on addressing and HTML. It separates URIs, URLs and URNs, reads a URL into its parts and explains how domain names are organised.
It then builds a valid HTML document from the doctype up, groups elements into their categories, explains why semantic tags matter to humans and crawlers, and shows how relative links, fragments, images and character references are written so that a page passes validation.
Lab 2, which runs in Week 3, then asks students to build, link and validate a small multi-page site from a plain-text template, fixing the first validator error before checking again.
What this chapter covers
- 01
URI, URL and URN
- 02
URL parts and domain hierarchy
- 03
The DOCTYPE, head and body skeleton
- 04
Elements, attributes and void elements
- 05
Semantic tags versus visual tags
- 06
Block and inline display
- 07
Absolute and relative links
- 08
Images, character references and validation
Worked example · free
Read the parts of a URL and link to it relatively
- 1Read left to right: https is the protocol, shop is the server name and example.com.au is the domain name.
- 1After the domain, /catalogue/ is the folder and index.html is the file the server will return.
- 1A page already in /catalogue/ shares the protocol, host and folder, so the relative link is simply href="index.html".
Key terms
- URI
- A URI is a string that identifies an Internet resource by its location, its name or both.
- URN
- A URN names a resource without implying that it can be fetched from any location.
- Top-level domain
- A top-level domain is the rightmost part of a domain name, such as .com, .edu or the country code .au.
- Void element
- A void element has no content and no end tag, such as br or hr.
- Phrasing content
- Phrasing content is inline markup within a paragraph, which cannot contain block content such as p.
- Character reference
- A character reference writes a reserved character safely, such as < for the less-than sign.
- Fragment identifier
- A fragment identifier is the part of a link after a hash that jumps to the element with a matching id.
URIs and HTML Document Structure FAQ
Why must HTML pass a validator if it already looks right?
Browsers repair broken markup in different ways, so a page that looks correct in one browser can fail in another or confuse a crawler. The course treats validation as part of correctness, and assignment pages that fail it lose marks, so fix the first reported error and validate again.
When should I use strong instead of b?
Use strong when the text is important and em when it carries stress emphasis, because those tags tell crawlers and assistive technology what the text means. The b and i elements only change appearance, so they are a last resort, and purely visual bolding belongs in CSS.
Should links inside my own site be absolute or relative?
Use relative links inside your own site and absolute links only for other sites. Relative paths leave out the protocol and host, so the whole folder can be moved or zipped and every internal link still works.
What goes in the head of an HTML document and what goes in the body?
The head holds information about the document rather than displayed content: the character encoding in a meta element, the title shown in the browser tab and search results, and other machine-readable details. The body holds everything the reader sees, starting with the main heading.
Why does the course care that a page has two audiences?
People read pages in a browser, while crawlers browse the Web systematically to index it and read only the markup. Meaningful headings, emphasis and lists help both, so semantic HTML improves accessibility for readers and visibility in search results at the same time.
Exam move
Write the minimal valid document skeleton by hand until you can do it in under a minute without errors. Then take a paragraph of plain text and mark it up with headings, strong, em, a list and one link, and run it through a validator. For relative paths, set yourself five pairs of file locations and write the shortest href for each before checking by drawing the folder tree.
Keep a list of the validator errors you trigger most often and check every new page against it before submitting.
Working through URIs and HTML Document Structure in SENG1050? Sia is AskSia’s AI Computer Science tutor — ask any SENG1050 URIs and HTML Document Structure question and get a clear, step-by-step explanation grounded in how SENG1050 is taught and assessed. Read this chapter free, then take your hardest questions to Sia.