473,394 Members | 1,663 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Can someone tell me what is wrong with css header code to fix for IE?

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.

Expand|Select|Wrap|Line Numbers
  1. /* CSS Document */
  2.  
  3. body  {
  4.     font: 100% Verdana, Arial, Helvetica, sans-serif;
  5.     background: #666666;
  6.     background-color: #081934;
  7.     margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
  8.     padding: 0;
  9.     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 */
  10.     color: #000000;
  11. }
  12. .twoColFixLtHdr #container { 
  13.     width: 850px;  /* using 20px less than a full 800px width allows for browser chrome and avoids a horizontal scroll bar */
  14.     height: 640px;
  15.     background: #FFFFFF;
  16.     margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */
  17.     border: 1px solid #000000;
  18.     text-align: left; /* this overrides the text-align: center on the body element. */
  19.     background-image: url(images/bkgrnd.jpg);
  20. .twoColFixLtHdr #header {
  21.     background: none;
  22.     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. */
  23.     position:absolute;
  24.     width: 807px;
  25. .twoColFixLtHdr #header h1 {
  26.     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 */
  27.     padding: 10px 0; /* using padding instead of margin will allow you to keep the element away from the edges of the div */
  28. }
  29. .twoColFixLtHdr #sidebar1 {
  30.     float: left; /* since this element is floated, a width must be given */
  31.     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 */
  32.     background: none; /* the background color will be displayed for the length of the content in the column, but no further */
  33.     padding: 60px 0px 0px 47px;
  34. }
  35. .twoColFixLtHdr #mainContent { 
  36.     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. */
  37.     padding: 65px 0 0px 20px; /* remember that padding is the space inside the div box and margin is the space outside the div box */
  38. .twoColFixLtHdr #footer { 
  39.     padding: 0 10px 0 20px; /* this padding matches the left alignment of the elements in the divs that appear above it. */
  40.     background:#DDDDDD; 
  41. .twoColFixLtHdr #footer p {
  42.     margin: 0; /* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */
  43.     padding: 10px 0; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */
  44. }
  45. .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. */
  46.     float: right;
  47.     margin-left: 8px;
  48. }
  49. .fltlft { /* this class can be used to float an element left in your page */
  50.     float: left;
  51.     margin-right: 8px;
  52. }
  53. .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 */
  54.     clear:both;
  55.     height:0;
  56.     font-size: 1px;
  57.     line-height: 0px;
  58. }
  59.  
  60. ____________________________________________
  61.  
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  5. <title>Untitled Document</title>
  6.  
  7. <link href="style.css" rel="stylesheet" type="text/css" />
  8. </head>
  9.  
  10. <body class="twoColFixLtHdr">
  11. <div id="container">
  12.   <div id="header">
  13.     <img src="http://bytes.com/images/plan_header.png" alt="plan" name="plan_banner" width="759" height="51" border="0" id="plan_banner" />
  14.   <!-- end #header --></div>
  15.   <div id="sidebar1">
  16.     <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>
  17.  
  18.         <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>
  19.  
  20.         <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>
  21.  
  22.         <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>
  23.  
  24.         <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>
  25.  
  26.         <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>
  27.  
  28.         <p><a href="index.html"><img src="http://bytes.com/images/welcome.png" alt="welcome" width="97" height="26" border="0" /></p>
  29.         <p><img src="http://bytes.com/images/plan_facts.png"  alt="" name="plan_facts" width="99" height="140" border="0" id="plan_facts" /></p>
  30.  
  31.   <!-- end #sidebar1 --></div>
  32.   <div id="mainContent">
  33.    <img src="http://bytes.com/images/sand.png" alt="sand" name="sand" width="642" height="561" border="0" id="sand" />
  34.     <!-- end #mainContent --></div>
  35.     <!-- This clearing element should immediately follow the #mainContent div in order to force the #container div to contain all child floats --><br class="clearfloat" />
  36.  
  37. <!-- end #container --></div>
  38. </body>
  39. </html>
i am using windows xp professional
Aug 1 '10 #1
1 2324
TheServant
1,168 Expert 1GB
Don't have time right now to test this out, but have you thought about using the background CSS property for your header div? Really, you should be putting as many images in your CSS as you can as they are generally only downloaded once. If you use <img /> tags, they can be downloaded every page load. You might find that will solve your problem anyway.
Aug 3 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Paul | last post by:
I need to insert a row into a table in SQL Server 2000. The primary key for the row is an identity type, so it auto-numbers for me without needing to put in the value in the insert statement. ...
10
by: Andreas Sheriff | last post by:
Please evaluate the following snippet: int a=5; int b; b = a++ + a; Edit1->Text = b; a = 5; b = a++ + ++a; Edit2->Text = b;
2
by: Just Me | last post by:
Dim iData As IDataObject = Clipboard.GetDataObject() Dim img As System.Drawing.Bitmap img = img.FromFile(ofd.FileName, True) Clipboard.SetDataObject(img) TextControl1.Paste() img.Dispose() : img...
2
by: venkatesh | last post by:
hai , i am using turboc++ compiler to run my c program. i written an program with structure sa foolws struct s { float x; }y; when i am accessing the variable x it shows the following error...
6
by: rlueneberg | last post by:
Can someone tell if Sitemap always require a starting root? Can it have more than one root? I am having a problem trying to hide a root node without hiding its children using a Treeview component....
3
by: mansoorindia | last post by:
Is there any possibility to change the header code to access.mdb file like we use in dbase/fox wherein we change the header hex code and after change header codes, the file is not open his own...
1
by: jobs | last post by:
Is there a way or an attribute I can set so that the selected page number in paging is a different color or is underlined? perhaps it's my skin or css, but In my gridviews I can't tell what page we...
2
by: ppuniversal | last post by:
Hello, Can someone tell a good Tutorial on Network Programming in C++, except Beej's Guide and Vijay Mukhi's tutorials. I want to make a Client Server application in C++ which will involve...
5
by: lucas | last post by:
is a javascript file; is ajax? or javascript but in hidden code? eval(function(p,a,c,k,e,d) {e=function(c)...
5
by: zewl | last post by:
The following series summation is an approximation for computing the natural logarithm of a floatingpoint value x: logx=–/2]+/3]–/4]+….+(-1)n+1(x-1)^n/n Where 2 >= x > 0 and n is a positive...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.