Hi guys,
I am learning HTML and CSS now a days and I have started working on a site as making a site is best way to learn HTML and CSS.
I have a small problem.
I am not able to horizontally center my div.
I have tried almost all ways given as sticky.
When I use position: relative; it center my div in all browsers except IE but if use any other way to center my div, it simply does not show in any browser including IE.
Here is my code, any sort of help will be appreciated
CODE( That is centering in all other browsers except IE)
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Untitled Page</title>
<meta name="GENERATOR" content="Created by BlueVoda">
<style type="text/css">
div#headerbg
{ background-image:url(images/header_bg.png);
background-repeat:repeat-x;
margin-top: 0px;
margin-left: auto;
margin-right: auto;
text-align: left;
height:88px;
}
div#header
{
width: 870px;
position: relative;
margin-top: 0px;
margin-left: auto;
margin-right: auto;
text-align: left;
}
body
{
text-align: center;
margin: 0;
}
</style>
</head>
<body bgcolor="#FFFFFF" text="#595959" link="#039BCA" vlink="#0393BC" alink="#00C3FF">
<div id="headerbg">
<div id="header">
<div id="headershade" style="overflow:hidden;position:absolute;left:1px;top:0px;z-index:0" align="left">
<img src="images/header_glow.png" id="Image2" alt="" align="top" border="0" style="width:862px;height:88px;"></div>
<div id="logo" style="overflow:hidden;position:absolute;left:0px;top:6px;z-index:1" align="left">
<img src="images/logo_05.png" id="Image3" alt="" align="top" border="0" style="width:369px;height:78px;"></div>
</div>
</div>
</body>
</html>
CODE(not showing any center in any browser)
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Untitled Page</title>
<meta name="GENERATOR" content="Created by BlueVoda">
<style type="text/css">
div#headerbg
{ background-image:url(images/header_bg.png);
background-repeat:repeat-x;
margin-top: 0px;
margin-left: auto;
margin-right: auto;
text-align: left;
height:88px;
}
div#header
{
width: 870px;
margin: 0px auto;
text-align: left;
}
body
{
text-align: center;
margin: 0;
}
</style>
</head>
<body bgcolor="#FFFFFF" text="#595959" link="#039BCA" vlink="#0393BC" alink="#00C3FF">
<div id="headerbg">
<div id="header">
<div id="headershade" style="overflow:hidden;position:absolute;left:1px;top:0px;z-index:0" align="left">
<img src="images/header_glow.png" id="Image2" alt="" align="top" border="0" style="width:862px;height:88px;"></div>
<div id="logo" style="overflow:hidden;position:absolute;left:0px;top:6px;z-index:1" align="left">
<img src="images/logo_05.png" id="Image3" alt="" align="top" border="0" style="width:369px;height:78px;"></div>
</div>
</div>
</body>
</html>
|