Skip to content

Instantly share code, notes, and snippets.

@dorofteiiuliana
Created August 4, 2016 12:15
Show Gist options
  • Save dorofteiiuliana/71977f2a53a06ee71084c35c597923f4 to your computer and use it in GitHub Desktop.
Save dorofteiiuliana/71977f2a53a06ee71084c35c597923f4 to your computer and use it in GitHub Desktop.
CENTER align elements
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