The most common and easiest type of centering is that of lines of text in an element. CSS has the rule text-align: center
for this purpose:
HTML
<p>Lorem ipsum</p>
CSS
p {
text-align: center;
}
This does not work for centering entire block elements. text-align
controls only alignment of inline content like text in its parent block element.
See more about text-align
in Typography section.