Software Engineering › How to answer › CSS and HTML questions
How to answer CSS and HTML questions
CSS questions are short (1 to 2 marks): read the code, match each selector to an element, and find what applies. From NESA material
What it looks like in the real exam
From NESA material 2025 HSC 2025 HSC exam, Q7 (1 mark, objective): a CSS code fragment; the answer is “Blue background, white text, border around the heading” (the code image is not published as text). 2025 sample 2025 NESA sample exam, Q16A (1 mark, multiple choice): why a style is not applied (id v class). 2025 sample 2025 NESA sample exam, Q16B (2 marks, short answer): outline TWO benefits of adding CSS.
The syntax and selectors
selector {
property: value;
property: value;
}| Selector | Matches | Example |
|---|---|---|
p | every element of that tag | p {color:red;} |
.note | every element with class="note" | .note {color:blue;} |
#intro | the one element with id="intro" | #intro {color:green;} |
From NESA material Core rule from the 2025 sample: a dot selects a class and a hash selects an id. If the HTML says id="qe_item" but the CSS says .qe_item, the rule never applies. From course notes General advice If several rules match, the more specific wins: id beats class beats tag.
| Property | What it does |
|---|---|
color | text colour |
background-color | background colour |
font-family, font-size | typeface and size |
font-weight: bold, font-style: italic | bold, italics |
text-align | left, centre, right |
border | a line around the element (for example 1px solid black) |
margin, padding | space outside / inside the border |
General advice Properties and values above are standard CSS. The linking line in HTML is <link rel="stylesheet" href="main.css">, and an error in that path means “main.css has not been correctly referenced”.
Method
- Read the question and note what it asks (cause of a problem, what the page looks like, benefits). General advice
- Read the HTML: find the element (tag, id, class) the question is about. From course notes
- Read each CSS rule and match its selector to that element: tag name,
.for class,#for id. Cross out rules that don’t match. From course notes - Apply what is left: if two rules set the same property, id beats class beats tag. General advice
- Describe the result property by property (colour, background, border). General advice
- Check spelling and punctuation: a missing dot, hash, colon or semicolon is often the “bug”. General advice
Worked examples
2025 NESA sample exam, Q16A · 1 mark
Official marking criteria
- 1 mark: Identifies the correct answer.
NESA marking guideline answer
Notes
sample-q16a
- Font family is missing
- Attribute of <span> has not been defined
- main.css has not been correctly referenced
- The id qe_item has not been correctly referenced
Answer: D (The id qe_item has not been correctly referenced)
From NESA material Why: .qe_item is a class selector; the span has an id. The fix is #qe_item in the CSS or class="qe_item" in the HTML.
2025 NESA sample exam, Q16B · 2 marks
Official marking criteria
- 2 marks: Outlines TWO benefits.
- 1 mark: Some relevant information.
NESA sample answer
Reasoned For a 2-mark “outline TWO” answer, write two separate sentences, each naming a benefit and a short reason (consistency across pages; developers can work on structure and style separately; one change updates every page).
2025 HSC exam, Q7 · 1 mark
Official marking criteria
- 1 mark: Identifies the correct answer.
NESA sample answer
Open this question page · some of the NESA wording or answer is an image or is unpublished, as noted
Original practice Original example in the same style. For h1 {color: white; background-color: blue; border: 2px solid black;} the heading is white text on a blue background with a black border.
Common mistakes
- From NESA material Confusing id and class selectors (the sample Q16 trap).
- General advice Choosing an option about the font when the problem is the selector.
- General advice Missing the semicolon or the closing brace.
- General advice Writing a vague benefit (“it looks better”) instead of consistency or maintenance.
Time per mark
Derived 140 minutes ÷ 80 marks = 1.75 minutes per mark, so 1 marks ≈ 1.8 minutes.
General advice Objective CSS item: under 2 minutes. 2-mark short answer: 3 to 4 minutes.
Practice (4 items, with answers)
Original practice item
Original practice
- Red
- Green
- Black
- Blue
Show the answer
Answer: B (Green)
Original practice item
Original practice
- It encrypts the pages
- The pages no longer need HTML
- Consistent appearance and easy maintenance because a change is made in one place
- The website loads without a server
Show the answer
Answer: C (Consistent appearance and easy maintenance because a change is made in one place)
Original practice item
Original practice
- warning
- *warning
- .warning
- #warning
Show the answer
Answer: C (.warning)
Item 4 · write the rule
Write a CSS rule that makes every <p> that has class “alert” red and bold.
Show the answer
.alert {
color: red;
font-weight: bold;
}Original practice Class selector (dot), then property and value pairs ending in semicolons.
Terms, flashcards and past questions
Key terms for this page: Cascading style sheets (CSS) · CSS rule syntax · CSS selectors (id v class) · CSS maintenance tools
Flashcards · All key terms · Learn step by step · All past questions · Multiple-choice bank · Mock exam
Past questions used on this page:
← How to draw a network or system diagramOnline exam tips: reading time, order of attack and time per mark →