1. Home
  2. Computer Science MCQs
  3. Cascading Style Sheets - CSS
  4. Which of these CSS selectors has the highest specificity?

Added 2 Nov 2026

Which of these CSS selectors has the highest specificity?

  1. #nav Correct answer
  2. .nav
  3. nav a
  4. .nav a

Correct answer

A. #nav

21 views

MCQSEXAM

Explanation

ID selectors outweigh any number of class or element selectors. Specificity runs from IDs, to classes, attributes and pseudo-classes, to elements.

Reference

Asked in: NTS, Web Developer Interviews

Preparing for an exam?

Doubts & discussion

Not sure why the answer is A? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Cascading Style Sheets - CSS MCQs

Practise all Cascading Style Sheets - CSS MCQs

Similar MCQs