TK Study

Software Engineering › Key terms › Y12 Programming for the Web › CSS selectors (id v class)

CSS selectors (id v class)

Code pattern Y12 Programming for the Web

Definition

A class selector (.name) styles many elements; an id selector (#name) styles one unique element.

Example

.button { color: white } styles every element with class button.

Found in: syllabus, course specifications, 2025 HSC marking guidelines, sample exam and familiarisation guidelines, school notes, past SDD papers.

Where it is used in the test

Syllabus area: Y12 Programming for the Web.

Question types it can appear in

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

These are the questions the flashcard set links to this term. Open each one and compare your answer with its marking criteria.

Study links

How to use it in an answer

A model sentence

General advice, built from the definition and example above

Code pattern: “A class selector (.name) styles many elements; an id selector (#name) styles one unique element.” Then apply it: .button { color: white } styles every element with class button.

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

From the linked past questions
  • 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

What the marking guidelines and feedback say

Sample exam Q16a (1 mark): CSS (id v class) · contains a reasoned or flagged note, read it as such

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.)

Open the question page

Common mistakes

General advice
  • 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.

Same group in the syllabus: W3C and WAI · Client-side (front-end) programming · Server-side (back-end) programming · SQL and non-SQL databases · Web browser and developer (dev) tools · Cascading style sheets (CSS) · CSS maintenance tools · Code libraries and frameworks (front end) · Open-source software · Version control · Load times · Minification · Lazy loading · Caching

← CSS maintenance toolsIn Y12 Programming for the WebData mining →