This should work with any div
or screen size:
.center-screen {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
min-height: 100vh;
}
<html>
<head>
</head>
<body>
<div class="center-screen">
I'm in the center
</div>
</body>
</html>
See more details about flex
here. This should work on most of the browsers, see compatibility matrix here.
Update: If you don't want the scroll bar, make min-height
smaller, for example min-height: 95vh;