

Sometimes, however, you may want to align things inside that line box against other things, for example, if you have an icon displayed alongside text, or text of different sizes. The property text-align will align that content on the page, for example, if you want your text centered, or justified. When we have some text and other inline elements on a page, each line of content is treated as a line box. As with much of CSS, you can go a long way by understanding the fundamental things about how the methods behave, and then need a place to go look up the finer details in terms of how you achieve the precise layout that you want. Instead of providing a comprehensive guide to each, I’ll explain a few of the sticking points people have and point to more complete references for the properties and values. In this article, I will take a look at the different alignment methods. However, knowing what is available means that you can always try a few tactics if you come across a particular alignment problem. We have a whole selection of ways to align things in CSS today, and it isn’t always an obvious decision which to use. In this article, Rachel Andrew explains what they are with some tips to help you remember which to use and why. There are a few ways to align elements in CSS.
