473,395 Members | 1,539 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,395 software developers and data experts.

Divs centreing in Firefox/Chrome but not IE

Good Evening

I am building a website using DIVs and CSS.

I have everything in a container DIV, which I want to centre on the page. The CSS is below:

Expand|Select|Wrap|Line Numbers
  1. #container{ 
  2.     width: 100%;
  3.     max-width: 1000px;
  4.     width:expression(document.body.clientWidth > 1000? "1000px": "auto" );
  5.     float: center;
  6.     color: #fff;    
  7.     margin-left: auto;
  8.     margin-right: auto;
  9.     padding: 0px;
  10.     border-width: 0px
  11.         } 
Yet for some reason, in IE it won't center. Any idea why?

On a similar vein, within the container I have a navigation bar. For some reason, it just won't center. I thought it was because it was a <ul> and then indented, but I have tried setting margin and padding to zero.

Any ideas?

Code below:

Expand|Select|Wrap|Line Numbers
  1. #navbar ul {
  2.     margin-left: 0px;
  3.     margin-right: 0px;
  4.     padding-left: 0px;
  5.     padding-right: 0px;
  6.     height: 27px;
  7.     list-style-type: none;
  8.     text-align: center;
  9.     font-weight: bold;
  10.     font-size: 13px;
  11.     border-width: 0px
  12.         } 
  13.  
  14. #navbar ul li {  
  15.     display: inline;
  16.     height: 25px;
  17.     width: 100px;
  18.     text-align: center;
  19.     border-width: 0px
  20.         } 
  21.  
  22. #navbar ul li a { 
  23.     float: left;
  24.     width: 100px;
  25.     margin-left: 10px;
  26.     margin-right: 10px;
  27.     text-decoration: none;
  28.     display: inline;   
  29.     line-height: 25px;
  30.     color: #fff; 
  31.     border-width: 0px;
  32.     background: url("buttons.jpg") no-repeat 0 0
  33.         } 
Thanks
Chris
Mar 30 '11 #1
1 1939
drhowarddrfine
7,435 Expert 4TB
In the first, there is no such thing as 'float:center'. Also, Microsoft dropped support for 'expression' in IE8.
Mar 30 '11 #2

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

Similar topics

8
by: gpbmike | last post by:
I'm wondering if anyone else has had this problem before. Every now and then a div on my page will overlap with another. Thi only happens in firefox (vs. IE and Safari) and it corrects itself whe...
5
by: gregmercer | last post by:
I have the following html sample, where I'd like to have a show and hide two divs, one replacing the other. Following these two divs is a third div (the bluediv) which I would like to have placed...
5
by: Spondishy | last post by:
Hi, I am using the following in my stylesheet to center divs in firefox. html>body { font-size: 13px; } div.centerdiv {
2
by: Jan Doggen | last post by:
Hello, The following code displays the name for all three elements in IE, but fails for the1st and 3rd in Firefox. What could be going on? I tried SPAN instead of DIV doesn;t work either....
1
by: JonBosker | last post by:
Hi I have a little script that works well in IE but not in FireFox function DivExpand(obj, setting) { if ((setting == 'hide') || ((setting == 'swap') && (document.all.style.display ==...
4
by: jwwest | last post by:
Hello all, I've been building a simple site based on XML, XSL and CSS in order to help me learn those technologies better. However, building a tableless page is brand new to me so I've run into...
3
by: Trevor2007 | last post by:
I have never been able to get the user.css file to work for me at ail, can any one help, I know how to change the web page font through the tools menue, but I would like to change the font size of...
7
by: mike57 | last post by:
The minimal AJAX script below works in Firefox, but not in IE, Opera, or Chrome. I could use some suggestions or referrals to resources that will help me get the script working in other browsers. ...
6
by: oneadvent | last post by:
This code works in Chrome and pulls a second drop down, but it will not work in IE6, (I dont have IE7/8 to check right now, but can later) and it works in FF, in IE it doesn't do anything at all. ...
1
by: jeanyl | last post by:
spotlight doesn't work in firefox and chrome... <html> <head> <title>Your title here</title> <style type="text/css"> <!-- #content{ position:absolute;top:0px;left:0px;text-align:center;
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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
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,...
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.