Simple way to align items in the center of a div.
<html>
<head>
<style>
html, body {
height: 100%;
width: 100%;
margin: 0;
font-family: Helvetica, "Helvetica Neue", sans-serif;
}
.container {
height: 100%;
width: 100%;
display: grid;
place-items: center;
}
.content {
padding: 30px;
border: solid 1px #00a0ff;
border-radius: 5px;
width: 300px;
text-align: center;
}
</style>
</head>
<body>
<div class="container">
<div class="content">
Hello World!!!
</div>
</div>
</body>
</html>
Top comments (0)