To add a background color to all <h1> elements, which CSS syntax is used?

2015

To add a background color to all <h1> elements, which CSS syntax is used?

Answer: A. h1 { background-color: #FFFFFF; }Key idea: Use the CSS selector h1 followed by a declaration block. Correct syntax: h1 { background-color: #FFFFFF; } The semicolon after the declaration is…

  1. A.

    h1 { background-color: #FFFFFF; }

  2. B.

    { background-color :#FFFFFF} . h1

  3. C.

    h1 { background-color :#FFFFFF} . h1(all)

  4. D.

    h1. all{bgcolor= #FFFFFF}

Attempted by 394 students.

Show answer & explanation

Correct answer: A

Key idea: Use the CSS selector h1 followed by a declaration block.

Correct syntax: h1 { background-color: #FFFFFF; }

The semicolon after the declaration is the standard complete CSS form; browsers may tolerate its omission only when it is the last declaration.

Final answer: Option A

Explore the full course: Tpsc Assistant Technical Officer

Loading lesson…