+ 1
How do I center text in the middle?
So, I know how to align text in the middle, you do it like this. selector { text-align: center } But how do I align it perfectly in the middle, like not right at the top, but in the center of the screen?
2 odpowiedzi
+ 6
Here is one way.
<h1 class="centered"> Content </h1>
.centered {
position: fixed;
top: 50%;
left: 50%;
margin-top: -50px;
margin-left: -100px;
}