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

Table wont Centre in FF 3?

384 256MB
I have the below code, now the text outside of the table will centre fine in IE and FF but the table will not centre at all in FF but is fine in IE??

Expand|Select|Wrap|Line Numbers
  1. <div id="search_body_wrapper">
  2.     <div id="search_body_results">
  3.         <b>3</b> result(s) found for <b>test</b>.<br /><br />
  4.         <table border="0" cellspacing="2" cellpadding="2">
  5.             <tr style="background-color: #CCCCCC;"><td style="font-weight: bold;">Case Number</td><td style="font-weight: bold;">Summary</td></tr>
  6.             <tr style="background-color: #DEDEDE;"><td>1000001</td><td>Test Case 1</td></tr>
  7.             <tr style="background-color: #DEDEDE;"><td>1000002</td><td>Test Case 2</td></tr>
  8.             <tr style="background-color: #DEDEDE;"><td>1000013</td><td>Test Case, Entered via web form</td></tr>
  9.         </table>
  10.     </div>
  11. </div>
Expand|Select|Wrap|Line Numbers
  1. #search_body_wrapper {
  2.     float: left;
  3.     width: 800px;
  4.     margin: 5px 5px 0 5px;
  5.     padding: 0 0 5px 0;
  6.     background-color: #FFFFFF;
  7.     text-align: left;
  8.     clear: left;
  9.     display: inline;
  10. }
  11. #search_body_results {
  12.     float: left;
  13.     width: 100%;
  14.     margin: 5px 0 0 0;
  15.     text-align: center;
  16.     clear: left;
  17.     display: inline;
  18. }
Jan 27 '09 #1
2 1771
drhowarddrfine
7,435 Expert 4TB
Well, you're floating it left, so it's supposed to be on the left side. Why would it be different?

I don't have IE available so I haven't a clue why IE is doing it wrong and centering it but I'd bet all the modern browsers don't center it either.

Anyway, to center the table, put this in your CSS:
Expand|Select|Wrap|Line Numbers
  1. table{
  2. margin:0 auto
  3. }
  4.  
and never, ever look at IE as a reference for how things should work.
Jan 28 '09 #2
IE is possibly doing it wrong because there's no doctype, or an incomplete doctype, or some text or something before the doctype. IE in Quirks Mode will let text-align center blocks like tables when it shouldn't.

If the margin: 0 auto thing doesn't work at first, make sure that

the thing you want to center has a width
and
that width isn't 100% (you can't center something that's 100% wide)
Feb 5 '09 #3

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

Similar topics

9
by: Bjoern Wolfgardt | last post by:
Hi, I have read the you should no longer use 'align="center"' when you want to center a table or something other. So I asked myself what should I use than. I found something that you should use...
6
by: Colin Walls | last post by:
I am writing some HTML and CSS that will eventually be produced by a program for running fencing tournaments. Everything is fine apart from column alignment for numbers. Have a look at...
7
by: Alex | last post by:
Hi all, I am trying to install a java stored procedure via the windows development centre. The linux box is running 8.1 FP4 as is the windoze platform. If I am on the linux box i can install...
20
by: Neil Robbins | last post by:
I am trying to execute a make table query in my vb.net program. The db that I am accessing is an Access 2000 format db. The SQL code that I am using has been cut and pasted from the SQL View having...
1
by: jan.gezels | last post by:
Hi We're use DB2 with Data propagator. When I open Replication Centre no config is shown (no capture or apply servers) but everything is still working like it should. If I try to reconfigure, I...
3
by: Eric | last post by:
When i run my query it transfer last 4 digits of account number from one table to another and its wrong. There are two tables one i use for parsing. Second thru query i use to move data from temp...
10
by: sandraz444 | last post by:
I have an expression in the query under my form to autofill the date under a certain condition but it wont write to the underlying table?? The date shows in the form but not the table. Does anyone...
16
by: Charles A. Landemaine | last post by:
I set a table with 100% width to occupy all available space, but in IE7 it uses more than that, it uses 100% of the page width instead of 100% of the table container. Could you test the page in IE7...
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
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...
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
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...
0
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...
0
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,...

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.