Use this simple css code to center page. The style has not been tested with all types and version of browsers, so if it does not work for you try some other suggested code on this website, simply searching for “centering.’
External style sheet
Style.css |
@charset "utf-8"; /* CSS Document */
body
{
padding-top: 10px;
text-align: center;
}
.center_body
{
text-align: left;
width: 960px;
height: 600px;
padding: 5px;
margin: 0 auto;
}
|
Centered-Page.html |
Import external css in the page
<link rel="stylesheet" type="text/css" href="style.css" />
|
Internal style sheet
Centered-Page.html |
<style type="text/css">
body
{
padding-top: 10px;
text-align: center;
}
.center_body
{
text-align: left;
width: 960px;
height: 600px;;
padding 5px;
margin: 0 auto;
}
</style>
|