Created
November 24, 2012 06:22
-
-
Save markvital/4138645 to your computer and use it in GitHub Desktop.
Another way to center div in position:absolute CSS
This file contains 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
<html> | |
<head><title> Centered content</title></head> | |
<body> | |
<div style="position: absolute; left: 50%;"> | |
<div style="position: relative; left: -50%; border: dotted red 1px;"> | |
I am some centered shrink-to-fit content! <br /> | |
tum te tum | |
</div> | |
</div> | |
</body> | |
</html> | |
<!-- insipred by http://stackoverflow.com/a/1777282 --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment