In all browsers other than IE the header image is centered over the nav & main content area. In IE it is pushed to the left.
i am using windows xp professional
Code:
/* CSS Document */
body {
font: 100% Verdana, Arial, Helvetica, sans-serif;
background: #666666;
background-color: #081934;
margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
padding: 0;
text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
color: #000000;
}
.twoColFixLtHdr #container {
width: 850px; /* using 20px less than a full 800px width allows for browser chrome and avoids a horizontal scroll bar */
height: 640px;
background: #FFFFFF;
margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */
border: 1px solid #000000;
text-align: left; /* this overrides the text-align: center on the body element. */
background-image: url(images/bkgrnd.jpg);
}
.twoColFixLtHdr #header {
background: none;
padding: 20px 0px 0px 45px; /* this padding matches the left alignment of the elements in the divs that appear beneath it. If an image is used in the #header instead of text, you may want to remove the padding. */
position:absolute;
width: 807px;
}
.twoColFixLtHdr #header h1 {
margin: 20; /* zeroing the margin of the last element in the #header div will avoid margin collapse - an unexplainable space between divs. If the div has a border around it, this is not necessary as that also avoids the margin collapse */
padding: 10px 0; /* using padding instead of margin will allow you to keep the element away from the edges of the div */
}
.twoColFixLtHdr #sidebar1 {
float: left; /* since this element is floated, a width must be given */
width: 120px; /* the actual width of this div, in standards-compliant browsers, or standards mode in Internet Explorer will include the padding and border in addition to the width */
background: none; /* the background color will be displayed for the length of the content in the column, but no further */
padding: 60px 0px 0px 47px;
}
.twoColFixLtHdr #mainContent {
margin: 0 0 0 0px; /* the left margin on this div element creates the column down the left side of the page - no matter how much content the sidebar1 div contains, the column space will remain. You can remove this margin if you want the #mainContent div's text to fill the #sidebar1 space when the content in #sidebar1 ends. */
padding: 65px 0 0px 20px; /* remember that padding is the space inside the div box and margin is the space outside the div box */
}
.twoColFixLtHdr #footer {
padding: 0 10px 0 20px; /* this padding matches the left alignment of the elements in the divs that appear above it. */
background:#DDDDDD;
}
.twoColFixLtHdr #footer p {
margin: 0; /* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */
padding: 10px 0; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */
}
.fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */
float: right;
margin-left: 8px;
}
.fltlft { /* this class can be used to float an element left in your page */
float: left;
margin-right: 8px;
}
.clearfloat { /* this class should be placed on a div or break element and should be the final element before the close of a container that should fully contain a float */
clear:both;
height:0;
font-size: 1px;
line-height: 0px;
}
____________________________________________
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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body class="twoColFixLtHdr">
<div id="container">
<div id="header">
<img src="http://bytes.com/images/plan_header.png" alt="plan" name="plan_banner" width="759" height="51" border="0" id="plan_banner" />
<!-- end #header --></div>
<div id="sidebar1">
<p><a href="plan.html"><img src="http://bytes.com/images/plan_icon.png" alt="plan" name="plan_icon" width="98" height="131" border="0" id="plan_icon" /></a></p>
<p><a href="hotel.html"><img src="http://bytes.com/images/hotel_tag.png" alt="hotel" name="hotel_tag" width="97" height="27" border="0" id="hotel_tag" /></a></p>
<p><a href="guestbook.html"><img src="http://bytes.com/images/guestbook_tag.png" alt="guestbook" name="guestbook_tag" width="97" height="26" border="0" id="guestbook_tag" /></a></p>
<p><a href="riviera_maya.html"><img src="http://bytes.com/images/riviera_maya_tag.png" alt="riviera_maya" name="riviera_tag" width="99" height="26" border="0" id="riviera_tag" /></a></p>
<p><a href="rsvp.html"><img src="http://bytes.com/images/rsvp_tag.png" alt="rsvp" name="rsvp_tag" width="97" height="26" border="0" id="rsvp_tag" /></a></p>
<p><a href="questions.html"><img src="http://bytes.com/images/questions_tag.png" alt="questions" name="questions_tag" width="97" height="26" border="0" id="questions_tag" /></a></p>
<p><a href="index.html"><img src="http://bytes.com/images/welcome.png" alt="welcome" width="97" height="26" border="0" /></p>
<p><img src="http://bytes.com/images/plan_facts.png" alt="" name="plan_facts" width="99" height="140" border="0" id="plan_facts" /></p>
<!-- end #sidebar1 --></div>
<div id="mainContent">
<img src="http://bytes.com/images/sand.png" alt="sand" name="sand" width="642" height="561" border="0" id="sand" />
<!-- end #mainContent --></div>
<!-- This clearing element should immediately follow the #mainContent div in order to force the #container div to contain all child floats --><br class="clearfloat" />
<!-- end #container --></div>
</body>
</html>
Comment