Center align text using CSS
Learn how to center text in CSS.
text editor | × | 1 |
browser | × | 1 |
Howchoo is reader-supported. When you buy through links on our site, we may earn a small affiliate commission at no cost to you.
Learn how to center text in CSS.
text editor | × | 1 |
browser | × | 1 |
Howchoo is reader-supported. When you buy through links on our site, we may earn a small affiliate commission at no cost to you.
The css property "text-align" can be applied to any HTML element containing text. For example:
<h1>Welcome!</h1>
Because h1 elements are display:block by default, the text can be aligned to the left, right or center. So adding
h1 {
text-align: center;
}
This would center the heading "Welcome!" on the page.
SVGs are great; making them smaller makes them even greater. This guide will show you how to optimize SVGs.