Which is the correct CSS syntax?
-
body {color: black}
-
body:color=black
-
{body:color=black(body}
-
{body;color:black}
Reveal answer
Fill a bubble to check yourself
A
Correct answer
Explanation
CSS uses selector {property: value} syntax. The selector targets elements, curly braces contain the rules, properties are followed by colons, and value pairs end with semicolons. Option A shows this correctly with body as selector, color as property, and black as value.
AI explanation
Valid CSS rule syntax is selector { property: value; }, so body {color: black} correctly targets the body selector and sets its color property. The other options misuse punctuation (colons/equals signs/parentheses) in ways that don't conform to CSS's actual grammar.