Learn
CSS Visual Rules
Text Align

No matter how much styling is applied to text (typeface, size, weight, etc.), text always appears on the left side of the browser.

To align text we can use the text-align property. The text-align property will align text to the element that holds it, otherwise known as its parent.

h1 { text-align: right; }

The text-align property can be set to one of the following three values:

  1. left — aligns text to the left hand side of its parent element, which in this case is the browser.
  2. center — centers text inside of its parent element.
  3. right — aligns text to the right hand side of its parent element.

Instructions

1.

In style.css, set the text-align property of the main heading so that it appears in the center.

Folder Icon

Take this course for free

Already have an account?