1. Home
  2. Computer Science MCQs
  3. HTML
  4. Which attribute is used to specify a unique identifier for…

Added 20 Jan 2024

Which attribute is used to specify a unique identifier for an HTML element?

  1. id Correct answer
  2. class
  3. identifier
  4. unique

Correct answer

A. id

12 views

MCQSEXAM

Explanation

The id attribute gives an element a unique identifier; its value must not be repeated anywhere else on the same page. It is used for CSS (#header), for JavaScript (getElementById) and for in-page links.

class, by contrast, can be shared by many elements.

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