Created
April 15, 2016 13:17
-
-
Save khajavi/b22da5bd0d82dab24f6848d4fe2dfef3 to your computer and use it in GitHub Desktop.
center div vertically in another div
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> | |
<head> | |
<link rel="stylesheet" href="style.css"> | |
<script src="script.js"></script> | |
</head> | |
<style> | |
#base { | |
width: 5em; | |
height: 5em; | |
background-color: red; | |
display: table-cell; | |
vertical-align: middle; | |
} | |
#inner { | |
background-color: blue; | |
height: 2em; | |
} | |
</style> | |
<body> | |
<div id="base"> | |
<div id="inner"> | |
</div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://rawgit.com/khajavi/b22da5bd0d82dab24f6848d4fe2dfef3/raw/d5210089157f69a45338619d9eb8c3a7f7036a0c/index.html