Software Engineering › Key terms › Code patterns › CSS rule syntax
CSS rule syntax
Code pattern Code patterns
Definition
selector { property: value; } with comments in /* */. h1 targets an element, #welcome targets an id, .red-text targets a class.
Example
.red-text { color: red; }Found in: course specifications.
Where it is used in the test
Syllabus area: Code patterns.
Question types it can appear in
- Code reading: Read CSS (2025 Q7)
- Multiple choice: Pick the option that matches the definition or example.
Where it has appeared in the paper
Programming for the Web (Part A, B). Part letters follow each paper’s own layout.
Related past questions
- 2025 HSC Q7 (1 mark): CSS code fragment Programming for the Web (Part A) · 1 mark
- Sample exam Q16a (1 mark): CSS (id v class) Programming for the Web (Part B) · 1 mark
These are the questions the flashcard set links to this term. Open each one and compare your answer with its marking criteria.
Study links
- Flashcard: CSS rule syntax in Code Patterns: Pseudocode, Python, SQL, CSS (Years 11 and 12) · study that set
- Memorise: SQL: HSC syntax and must-know queries
How to use it in an answer
A model sentence
Code pattern: “selector { property: value; } with comments in /* */.” Then apply it: .red-text { color: red; }
In a short answer, give the definition in your own words first, then tie it to the situation in the question. Do not copy the example above unless it fits the scenario.
Command words used with it
- Identify: Recognise and name. (2025 HSC Q7 (1 mark): CSS code fragment, Sample exam Q16a (1 mark): CSS (id v class))
Technique for the question types
- Multiple choice: Read all four options, rule out wrong ones, pick one; no penalty for guessing so never leave blank.
What the marking guidelines and feedback say
FLAG: the NESA MG prints the answer as 'The id "se_item" ...' while the question printout says "qe_item". This is an official inconsistency; the option is the 'id ... not correctly referenced' one. Fix: use class="qe_item" in the HTML or #qe_item in the CSS.
Worked answers from the marking guidelines
Sample exam Q16a (1 mark): CSS (id v class) (1 mark): criteria and sample answer
Criteria
1: Identifies the correct answer.
Sample answer
The id qe_item has not been correctly referenced. (The HTML uses id="qe_item" but the CSS selector is .qe_item, which targets a CLASS. An id selector is #qe_item.)
Common mistakes
- Use the term exactly as the syllabus words it, then link it to the scenario in the question; the 2025 feedback repeatedly rewards using the stimulus.
- Answer the command word: outline gives main points only, explain gives a reason or cause, discuss gives both sides.
Related terms
Same group in the syllabus: SQL statement structure · SQL relational and logical operators · SQL calculated aggregate with GROUP BY · XSS JavaScript fragment reading · Shell script pattern