The text-align property

Hi, from the Front-End Career Path, CSS visual rules it says ‘The text-align property places text in the left, right, or center of its parent container.’ In the video at the end ‘CSS visual rules’ the instructor uses the text-align property on the [main] element for styling text within it. I would expect to use the text-align property to style the h1 and p within [main]. Any clarification on this? Kind regards, Jan

I’m guessing it’s because text-align is an inheritable CSS property. So if you set it on a parent container, it will “cascade” down to its children and be automatically applied to them as well. Not all properties do this, but you can look it up if a property seems to be behaving oddly or affecting things you didn’t expect it to.

from https://www.w3schools.com/cssref/pr_text_text-align.ASP