HTML Code


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns='"http://www.w3.org/1999/xhtml" xml:lang="en">

<head>

<title>
    Vertically Middle and Horizontally Centering
    WebSite in through div structure
</title>

<meta http-equiv="content-type" content="text/html; charset=utf-8" />

<body>

<div id="shim"></div>

<div id="wrapper">

My Content goes here

</div>

</body>

</html>

CSS Code :


html, body {
   height: 100%;
   margin: 0;
   padding: 0;
   overflow:hidden;
   background:#0000ff
}

* {
   margin:0px auto;
   padding:0;
}

div#shim {
   visibility: hidden;
   width: 100%;
   height: 50%;
   margin-top: -317px;
   _margin-top:-318px;
   float: left;
}

div#wrapper {
   width: 1000px;
   height: 635px;
   clear: both;
   background:red;
   position: relative;
   top: -317px;

/* IE4ever Hack: Hide from IE4 **/
   position: static;
/** end hack */

}

/* Hide from IE5mac \*//*/

div#shim {
  display: none;
}

html, body {
  height: auto;
}

/* end hack */

/* ]]> */
Advertisements