Created
August 4, 2016 12:15
-
-
Save dorofteiiuliana/71977f2a53a06ee71084c35c597923f4 to your computer and use it in GitHub Desktop.
CENTER align elements
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
http://www.w3schools.com/css/tryit.asp?filename=trycss_align_container | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<style> | |
.center { | |
margin: auto; | |
width: 60%; | |
border: 3px solid #73AD21; | |
padding: 10px; | |
} | |
</style> | |
</head> | |
<body> | |
<h2>Center Align Elements</h2> | |
<p>To horizontally center a block element (like div), use margin: auto;</p> | |
<div class="center"> | |
<p><b>Note: </b>Using margin:auto will not work in IE8, unless a !DOCTYPE is declared.</p> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment