AIDM7450 Chap.1 HTML Structure and CSS Foundations
HTML Structure and CSS Foundations
Three responsibilities in one page
HTML supplies structure and meaning, CSS supplies presentation, and JavaScript later supplies behaviour. This chapter builds the document tree from head and body, headings, paragraphs, links and grouping elements before it introduces CSS rules.
It then compares inline, embedded and external styles by scope and maintenance cost, and treats type, class and ID selectors as promises about how broadly a rule may be reused. The debugging method is to classify a defect as structure, selector, declaration or path before changing code.
A local link, in-page anchor and remote URL may all use the same element while depending on different address rules.
Likewise, two CSS declarations may look similar while reaching one element, one document or an entire site. The chapter therefore asks two questions before syntax: what responsibility owns the result, and how widely should the decision apply? Those questions prevent a visual override from hiding broken structure.
What this chapter covers
- 01
HTML document structure and visible content
- 02
Block and inline grouping with div and span
- 03
Remote, local, relative and in-page links
- 04
CSS selectors and property-value declarations
- 05
Inline, embedded and external stylesheet scope
- 06
Type, class and unique ID selection
Worked example · free
Refactor duplicated magazine styles
- 3Move shared declarations to one linked external stylesheet.
- 3Replace repeated IDs with a reusable caption class.
- 2Keep one explicit class for the genuine exception.
Key terms
- HTML Element
- A structured unit of markup represented by a tag, content and any attributes.
- Block Element
- An element that participates as a block in document flow and normally begins a new line.
- Inline Element
- An element that groups content within an existing line without creating a new block.
- CSS Selector
- The part of a CSS rule that identifies which elements receive its declarations.
- External Stylesheet
- A separate CSS file linked by documents so shared presentation has one source.
HTML Structure and CSS Foundations FAQ
How do I decide whether a defect belongs to HTML or CSS?
Remove appearance from the diagnosis. If the content, hierarchy or destination is absent or wrong, repair HTML. If the right element exists and performs the right role but looks wrong, inspect CSS. A click-dependent change belongs to the behaviour layer instead.
When should I use a class instead of an ID?
Use a class for a category that several elements may share and an ID for one unique role in the document. Repeating an ID creates ambiguous lookups and links. Creating a unique class for every element removes the reuse classes are meant to express.
Why prefer an external stylesheet for shared design?
An external stylesheet gives several pages one source for colour, spacing and layout. A site-wide change is then made once. Inline and embedded rules remain useful for genuine exceptions or document-specific design, but copying them across pages creates avoidable maintenance work.
Exam move
Build one page in two passes. First write only semantic structure and test every link. Then add an external stylesheet, beginning with broad reusable rules and ending with narrow exceptions. For each unexpected result, write whether the fault is structure, path, selector or declaration before editing. This forces the three web responsibilities to remain visible.
Make a small link matrix containing one remote address, one sibling file, one child path and one in-page destination; predict the resolved target before selecting each link. Next inspect a single heading and list every rule that reaches it, including the browser default, external sheet, embedded block and inline style if present. Remove rules from narrowest to broadest and explain each change in the computed result.
Finish by refactoring a repeated inline declaration into a class, then into an external rule shared by two pages. Check that unique roles retain unique IDs and repeated categories use classes. A useful final test is to read the document with styles disabled: headings should still communicate hierarchy, destinations should still work, and image descriptions should still carry meaning.
Restore CSS and verify that no new selector was added merely to overpower an avoidable conflict. Keep a repair log with the observed symptom, owning layer, smallest change and retest result; this makes accidental overrides visible and turns debugging into a repeatable method.
Working through HTML Structure and CSS Foundations in AIDM7450? Sia is AskSia’s AI Computer Science tutor — ask any AIDM7450 HTML Structure and CSS Foundations question and get a clear, step-by-step explanation grounded in how AIDM7450 is taught and assessed. Read this chapter free, then take your hardest questions to Sia.