1. Home
  2. Computer Science MCQs
  3. HTML
  4. The correct example of class selector is .

Added 20 Jan 2024

The correct example of class selector is .

  1. h2.type1 {color: #000000;} Correct answer
  2. h2 type1 {color: #000000;}
  3. h2 #type1 {color: #000000;}
  4. #h2 type1 {color: #000000;}

Correct answer

A. h2.type1 {color: #000000;}

13 views

MCQSEXAM

Explanation

h2.type1 {color: #000000;} is the correct class selector. The dot joins the element name to the class name with no space, so the rule applies only to <h2> elements with class="type1".

A space would turn it into a descendant selector, and # denotes an ID, not a class.

Keep preparing with more Computer Science MCQs on MCQsExam.com.

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 HTML MCQs

Practise all HTML MCQs

Similar MCQs