Skip to content

Instantly share code, notes, and snippets.

@mutalis
Created August 9, 2022 18:31
Show Gist options
  • Save mutalis/5ff8f1d7b3fff1659c464a577553f927 to your computer and use it in GitHub Desktop.
Save mutalis/5ff8f1d7b3fff1659c464a577553f927 to your computer and use it in GitHub Desktop.
<!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>Centering divs</title>
<style>
* {
box-sizing: border-box;
margin: 0px;
padding: 0px;
}
#parentContainer {
display: flex;
/* display: grid; */
width: 400px;
height: 400px;
background-color: #f55353;
}
#childContainer {
margin: auto;
width: 100px;
height: 100px;
background-color: #feb139;
}
</style>
</head>
<body>
<div id="parentContainer">
<div id="childContainer"></div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment