Sign in Registration

How to align an element with the CSS text-align property

When layout pages of a site or when publishing new materials, there may be a need to align the content of an element on either side. For this there is a special CSS styles correctly - text-align , which has several meanings. How to use it and what values ​​it has - will be discussed below.


First of all, it is necessary to clarify that the text-align property is intended only for the horizontal alignment of any inline elements within an element. That is, not only text can be aligned in this way, but also any linear content, for example, images can be aligned.

Example property syntax:

  .class {
text-align: center;

What values ​​does the text-align property have? There are not so many of them, let's list the main ones:

There are also additional values, their support must be checked in a specific browser:

Thus, it will not be difficult to align any inline (linear) element. This property is supported by all browsers, only new optional values ​​should be used with caution.

Comments (0)
For commenting sign in or register.

Latest articles

Popular sections


Login to the web version
Android app:
Available on Google Play

Share this

Subscribe to