Use margin to align block to center : margin : Box Model HTML CSS TUTORIALS


HTML CSS TUTORIALS » Box Model » margin »

 

Use margin to align block to center


 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en'>
    <head>
        <title>margin</title>
        <style rel='stylesheet' type='text/css'>
body {
    margin: 10px;
    padding: 0;
}
div {
    width: 50px;
    height: 50px;
    background: rgb(218220243);
    border: 1px solid rgb(154157203);
}
div#center {
    margin: 10px auto;
}
      
        </style>
    </head>
    <body>

        <div id='center'>
        </div>

    </body>
</html>

 



HTML code for linking to this page:

Follow Navioo On Twitter

HTML CSS TUTORIALS

 Navioo Box Model
» margin