<!DOCTYPE html>
<html>
<head>
<style>
.container {
height: 200px;
position: relative;
border: 3px solid green;
}
.center {
margin: 0;
position: absolute;
top: 50%;
left: 50%;
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
</style>
</head>
<body>
<h2>Centering</h2>
<p>In this example, we use positioning and the transform property to vertically and horizontally center the button element:</p>
<div class="container">
<div class="center">
<button>Centered Button</button>
</div>
</div>
</body>
</html>