translate
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
* {
margin: 0;
padding: 0;
}
body, html{
width: 100%;
height: 100%;
}
.container {
width: 500px;
height: 500px;
background-color: aqua;
position: relative;
}
.box {
background-color: red;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
</style>
</head>
<body>
<div class="container">
<div class="box">jkahgjahkjdghajkdgh</div>
</div>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
* {
margin: 0;
padding: 0;
}
body, html{
width: 100%;
height: 100%;
}
.container {
width: 500px;
height: 500px;
background-color: aqua;
display: flex;
justify-content: center;
align-items: center;
}
.box {
background-color: red;
}
</style>
</head>
<body>
<div class="container">
<div class="box">jkahgjahkjdghajkdgh</div>
</div>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
* {
margin: 0;
padding: 0;
}
body, html{
width: 100%;
height: 100%;
}
.container {
width: 500px;
height: 500px;
background-color: aqua;
display: grid;
justify-content: center;
align-items: center;
}
.box {
background-color: red;
}
</style>
</head>
<body>
<div class="container">
<div class="box">jkahgjahkjdghajkdgh</div>
</div>
</body>
</html>