Created
August 9, 2022 18:31
-
-
Save mutalis/5ff8f1d7b3fff1659c464a577553f927 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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