nerdexam
CIW

1D0-61B · Question #25

When a developer wants to center a paragraph of text, which code should she use?

The correct answer is C. <p style="text-align: center"> This is the text to center</p>. Option C is correct because inline CSS styles in HTML are applied using the style attribute with a value formatted as property: value - so style="text-align: center" is the proper syntax. A is wrong because text-align is a CSS property, not an HTML attribute - you can't write…

CSS3 Coding

Question

When a developer wants to center a paragraph of text, which code should she use?

Options

  • A<p text-align="center">This is the text to center</p>
  • B<p"text-align: center"> This is the text to center</p>
  • C<p style="text-align: center"> This is the text to center</p>
  • D<p style: text-align="center"> This is the text to center</p>

How the community answered

(15 responses)
  • C
    93% (14)
  • D
    7% (1)

Explanation

Option C is correct because inline CSS styles in HTML are applied using the style attribute with a value formatted as property: value - so style="text-align: center" is the proper syntax.

  • A is wrong because text-align is a CSS property, not an HTML attribute - you can't write it directly inside the tag without the style attribute.
  • B is wrong because the style attribute is missing entirely; the quote mark appears before text-align, making it invalid HTML.
  • D is wrong because it reverses the syntax - style: is not how HTML attributes work; the colon belongs inside the quotes as part of the CSS declaration, not outside.

Memory tip: Think of it as two layers - the HTML attribute (style=) acts as a "container," and inside the quotes you write normal CSS (property: value). If either layer breaks its own syntax rules, the whole thing fails.

Topics

#inline CSS#text-align property#style attribute#CSS syntax

Community Discussion

No community discussion yet for this question.

Full 1D0-61B Practice