473,809 Members | 2,908 Online
Bytes | Software Development & Data Engineering Community
+ 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 2194
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
2788
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 Netscape and Explorer seem to assume that <A NAME> anchors target part of a vertical web page, where all that is needed is for the window to advance to the first character or whitespace after the target. In a horizontal page, this means that each...
2
14169
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 javascript to expand the table to the available window width. So whether the screen is maximized or partially minimized, the table fits snugly in the available display. The trouble is if I include a 'cols=' spec for the textarea box its width stays...
9
62538
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 alt="tree graphic (1k)" src="tree.gif" height="60" width="100%"> So I got a tree that looked like a funhouse mirror reflection - 60 pixels high, like I asked; but stretched fully across the screen. It looked like someone dragged a green...
4
7955
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 upper-left corner of the browser window. So I'm trying to keep it horizontally centered whatever screen resolution you are set in. I do not want to deal with table cells, just CSS. I think that I must have a three column DIV layout with the...
5
8195
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, John
2
14175
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
2862
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 tried setting the height and it doesn't do anything. I can set the width to some very large number like 3000px and that works ok, but it's a waste when the data doesn't require that much space. Is there a way to limit the height of the grid or of...
3
2747
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 centered horizontally no matter what, instead of sticking to the left side of the browser window in different res' or window adjusting of any kind. Thank you kindly
0
1702
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 checkboxes' labels don't align horizontally with the links. I tried to use style="vertical-align: top" and others in the list item and in the checkbox but they have no effect. ASP.NET creates a span tag around the input tag which doesn't do good. The style...
16
3582
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 could kindly point me in the right direction (using words that the vicar's wife would understand). The vertical thumbnails can be seen at the bottom of this page: http://www.zen86793.zen.co.uk/gmga2008/index.html ... the first image is in the right...
0
9721
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10633
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10376
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10375
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9198
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6880
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5686
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3860
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3011
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.