473,698 Members | 2,452 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Divs centreing in Firefox/Chrome but not IE

1 New Member
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 1957
drhowarddrfine
7,435 Recognized Expert Expert
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
5047
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 you refresh the page. Has anyone run into this before? Thanks -- gpbmik
5
2198
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 right up directly below to the first or second div, depending on which is showing. If you load the html in Firefox, and then click on the "Edit" link you can see that the first div is hidden, the second div is shown, however the third div is...
5
8031
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
1638
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. (What I finally want is to set style.invisibility for the text in that DIV) TIA Jan
1
1857
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 == 'block'))) document.all.style.display = 'none'; else document.all.style.display = 'block'; }
4
2496
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 a large amount of problems. The biggest seems that Firefox wants to put a line in between two of my nested tags for some reason. However, this is only in the XML version. To design the page, I first made an HTML version, then I created a XSL...
3
1961
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 the address bar to 16 or 20pt.(if this means I have to adjust the addresss bar itself to accomadate the font size change then I would also like to do that as well. It's been a few months since I have tried to play with the usercontent and other Css...
7
4037
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. Before there are six characters entered in the CAPTCHA code field, the 'Send' button is supposed to be disabled. When there are at least six characters in the CAPTCHA code field, the script attempts to verify the CAPTCHA w/AJAX. If it verifies, it...
6
4487
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. Thanks for any help! php code to push data to page: <?php $q=$_GET; //number $blown = explode(',',$q); $q = $blown; $appl = $blown;
1
1951
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
8678
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
8609
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9030
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...
0
8871
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7737
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...
1
6525
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4621
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
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 we have to send another system
3
2007
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.