<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>CSS</title>
<style>
.outer{
display: flex;
align-items: center;
justify-content: center;
}
.inner {
width: 300px;
border: 3px solid blue;
height: 100px;
}
h2, .inner {
text-align: center;
}
</style>
</head>
<body>
<h2> horizontally centered div using CSS </h2>
<div class="outer">
<div class="inner">Horizontally centered </div>
</div>
</body>
</html>