how to put text in the middle of a page css code example
Example 1: center div in middle of page
.centered {
position: fixed;
top: 50%;
left: 50%;
/* bring your own prefixes */
transform: translate(-50%, -50%);
}
Example 2: css align center
//HTML
<div class="parent">
<span>Hello World</span>
</div>
//CSS
.parent {
display: flex;
justify-content: center;
align-items: center;
}
Example 3: make web page float to center of page
.center {
text-align-last: center;
border: 2px solid black;
}
Example 4: how to set text to middle in div
.center {
margin: auto;
width: 50%;
border: 3px solid green;
padding: 10px;
}