center div tag on page css code example
Example 1: center on page css
body {
display: grid;
place-items: center;
height: 100vh;
margin: 0;
}
Example 2: show element at center of page
.centered {
position: fixed;
top: 50%;
left: 50%;
/* bring your own prefixes */
transform: translate(-50%, -50%);
}Remember this forever