
In this example, we have an which is placed on the upper left hand side of the page. When you are working with heading or paragraph tags, the default styling in HTML will position the text on the left hand side of the page. How to Use the text-align Property in CSS I will also talk about the tag and why you shouldn't use it to center text. In this article, I will show you how to use the text-align property in CSS and show you how to vertically align text using CSS Flexbox. But what is the best way to go about that? Text-align Property Examples The text-align properties are set to right, justify, and center.There will be many times where you will need to center some text using HTML and CSS. If the direction property is set to rtl, then the text will be aligned to the right side. If the direction property is set to ltr, then the text will be aligned to the left side. If inherit is used with the root element, then the initial value for this property will be used.ĭepends on the value of the direction property. inherit - The inherit keyword is used to specify that the value for this property should be taken from the parent element.

For example, the width of a line of text can be adjusted by varying the word spacing.

