Back to the 2020 paper

Module I: Introduction to Web Technologies & Architectures

20202m

If you want to align text to the right side of a block element in a cascading style sheet (CSS), then which of...

Worked SolutionAI Assisted

Correct Answer: text-align: right;

Explanation:

  • In Cascading Style Sheets (CSS), the text-align property specifies the horizontal alignment of inline content (like text, images, or inline blocks) within a block element or table-cell box.
  • Setting text-align: right; aligns the text flush with the right edge of the containing block element.

Syntax & Example:

p {
  text-align: right;
}

Common text-align Values:

  • left: Aligns text to the left margin (default in LTR languages).
  • right: Aligns text to the right margin.
  • center: Centers the text horizontally.
  • justify: Stretches lines so that every line has equal width.

Similar questions