473,468 Members | 1,364 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Horizontally centring a DIV in IE7.

KeredDrahcir
426 Contributor
I can't seem to get a DIV tag to center. it works fine in IE8, Firefox, Safari and Google Chrome and is more or less there in Opera. In IE7 (and IE6) I can't seem to get it to work.

What I need is a box that stretches the whole length of the window whatever the screen resolution or zoom. But then I need a copyright notice inside it that lines up with the left of the main content that it centred and 980px wide.

The HTML follows:
Expand|Select|Wrap|Line Numbers
  1.     <div id="footer">
  2.       <div id="footer_content">
  3.         <div id="copyright">
  4.           &nbsp; &nbsp; Copyright © Copyright notice        </div>
  5.         <div id="power">
  6.           Powered by <a href="URL" target="_blank">My Company</a> &nbsp; &nbsp;
  7.         </div>
  8.       </div>
  9.     </div>
I'm using two CSS files to keep my templates seperate from my styles. The CSS is:
Expand|Select|Wrap|Line Numbers
  1. #copyright      { position: absolute; top: 80px;  left: 0px;   width: 790px; height: 20px;  }
  2. #power          { position: absolute; top: 80px;  left: 790px; width: 190px; height: 20px;   }
  3. #footer         { position: relative; top: 0px;   margin-left: auto; margin-right: auto; width: 100%;  height: 100px;  }
  4. #footer_content { position: relative; top: 0px; left: 50%;   margin-left: -490px; width: 980px;  height: 100px;  }
And
Expand|Select|Wrap|Line Numbers
  1. #footer      { background-image:url('/images/footer.jpg');          font-weight: bolder;   padding: 7px 0 0 0; margin: 0 0 0 0;        color:#9596ea; text-align: center;  font-family:Arial; font-size:10pt; vertical-align: middle; }
  2. #footer_content{ text-align: center;}
  3. #copyright   {                                                                             padding: 0 0 0 0;   margin: 0 0 0 0;        color:#ffffff; text-align: left;    font-family:Arial; font-size:9pt ; vertical-align: middle; }
  4. #power       {                                                                             padding: 0 0 0 0;   margin: 0 0 0 0;        color:#ffffff; text-align: right;   font-family:Arial; font-size:9pt;  vertical-align: middle; }
  5.  
Can anyone suggest what I'm doing wrong? I've found several sites that say either use:
Expand|Select|Wrap|Line Numbers
  1. margin: 0 auto;
or
Expand|Select|Wrap|Line Numbers
  1. text-align: center;
or
Expand|Select|Wrap|Line Numbers
  1. width: 980px; left: 50%; padding-left: -480px;
Although one of these worked in IE8, Firefox, Safari, Google Chrome and Opera, none of them seem to work in IE7.
Apr 22 '10 #1
1 2166
drhowarddrfine
7,435 Recognized Expert Expert
I don't know why you need all that:
Expand|Select|Wrap|Line Numbers
  1. <style>
  2. #power{float:right}
  3. </style>
  4.     <p id="footer">
  5.         Copyright © Copyright notice
  6.         <span id="power">
  7.           Powered by <a href="URL" target="_blank">My Company</a> 
  8.         </span>
  9.     </p>
  10.  
IE7 does not work like IE8.
Apr 22 '10 #2

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

Similar topics

14
by: eric | last post by:
I am attempting to create <A HREF> links to <A NAME> targets in a series of extremely wide web pages composed of tables with text and images sitting side by side. This is a failure since both...
2
by: John Ramsden | last post by:
I have a form containing a table whose cells include prompt text strings and input areas, one of which is a textarea. These are specified using only percent values, and I use some simple...
9
by: puzzled | last post by:
I'm trying to use a small gif of a Christmas tree as a horizontal divider across the screen (which could be any number of pixels wide). My attempt at doing this was basically like this: <img...
4
by: metalseb | last post by:
Hi folks I built up a small website which is designed for 800x600 display. Runs just fine in this resolution but if you have a system in 1024 or 1280 pixels wide, the site just "sticks" in the...
5
by: John Topley | last post by:
Hi, I have a DIV containing an unordered list and to the right of the list I'd like to have a stack of three horizontally-aligned submit buttons - is it possible to achieve this? Thanks, ...
2
by: Marek Mänd | last post by:
Can the legend element in fieldset be placed automatically by Mozilla horizontally in the middle of fieldset?
5
by: shanti.miller | last post by:
I've got a grid that uses paging and displays a maximum of 10 records at a time. Sometimes the fields have a lot of data in them and the datagrid takes up way too much horizontal space. I've...
3
by: boien | last post by:
I have a div container that i have created now i just want to make sure that its horizontally centered in any browser and in any resolution, so that when ever its on 800x600 or 1280x1024 its STILL...
0
by: John Dalberg | last post by:
using VS 2005. I have an unordered list with list items which are displayed horizontally. Some of the list items have hyper links and some have checkboxes. The problem is that the...
16
by: Stan The Man | last post by:
I'm a CSS novice trying unsuccessfully to make three thumbnail images display horizontally instead of vertically. I suspect I'm missing something really stupid but I'll take the flak if someone...
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...
1
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...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.