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

Firefox, Div tags, Tables and Centering problems

Frinavale
9,735 Expert Mod 8TB
Hi there!

I don't know why I seem to be the only one with this problem...In Firefox when I'm displaying a table within a <div> and use the align="center" it does not center the table. I'm wondering if there is a way around this...

Eg
Expand|Select|Wrap|Line Numbers
  1. <div id="mainContent">
  2.      <table align="center">
  3.           ...
  4.      </table>
  5. </div>
  6.  
Thanks for your help!

-Frinny
Jan 31 '07 #1
7 6313
AricC
1,892 Expert 1GB
Hi there!

I don't know why I seem to be the only one with this problem...In Firefox when I'm displaying a table within a <div> and use the align="center" it does not center the table. I'm wondering if there is a way around this...

Eg
Expand|Select|Wrap|Line Numbers
  1. <div id="mainContent">
  2.      <table align="center">
  3.           ...
  4.      </table>
  5. </div>
  6.  
Thanks for your help!

-Frinny
Hey Frinny glad to see you made your way to the HTML forum!
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2. <html>
  3. <head>
  4. <title>STUFF</title>
  5. <style type="text/css">
  6. .clsTest
  7. {
  8. /* Centers in FF */
  9. text-align: -moz-center;
  10. /* Centers in IE */
  11. text-align: center;
  12. }
  13.  
  14. </style>
  15. </head>
  16. <body>
  17. <div class="clsTest">
  18.      <table style="border: 2px solid black">
  19.         <tr>
  20.         <td>Some Crap</td>
  21.     </tr>
  22.      </table>
  23. </div>
  24. </body>
  25. <html>
  26.  
Jan 31 '07 #2
drhowarddrfine
7,435 Expert 4TB
align="center" is deprecated. Don't use it.

He wants to center the table, not the text. With typos fixed:
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2. <html>
  3. <head>
  4. <title></title>
  5. <style type="text/css">
  6.  
  7. table
  8. {
  9. margin:0 auto;
  10. }
  11.  
  12. </style>
  13. </head>
  14. <body>
  15. <div class="clsTest">
  16.      <table style="border: 2px solid black">
  17.         <tr>
  18.         <td>Some Crap</td>
  19.     </tr>
  20.      </table>
  21. </div>
  22. </body>
  23. </html>
  24.  
Feb 1 '07 #3
AricC
1,892 Expert 1GB
With typos fixed:
</html> :)
Feb 1 '07 #4
acoder
16,027 Expert Mod 8TB
Expand|Select|Wrap|Line Numbers
  1. ...
  2. <title>STUFF</title>
  3. ...        <td>Some Crap</td>
  4. ...
Aric, could you not think of better test words?!
Feb 1 '07 #5
Frinavale
9,735 Expert Mod 8TB
...
Expand|Select|Wrap|Line Numbers
  1. <style type="text/css">
  2.  
  3. table
  4. {
  5. margin:0 auto;
  6. }
  7.  
  8. </style>
  9.  
Thanks so much its working perfectly now :)

-Frinny
Feb 1 '07 #6
drhowarddrfine
7,435 Expert 4TB
That's just the kind of guy I am. Perfect.
Feb 1 '07 #7
AricC
1,892 Expert 1GB
Aric, could you not think of better test words?!
I changed it, whooops LMAO sorry guys yesterday was a completely heinous work day. The kind where you go straight to the pub after work. Which I did, today should be better :) Thanks for the fix Doc I wouldn't want to look like a total arse!

Aric
Feb 1 '07 #8

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

Similar topics

5
by: Robert J. O'Hara | last post by:
For some time I've made use of the max-width property in CSS to cause my pages to appear as a centered block against a contrasting background. This works well in new browsers (Mozilla, etc.) and...
5
by: thatseattleguy | last post by:
I'm stumped. Visit: http://positivesweat.com/class.html ....and look at the tables in the middle labeled "morning" and "evening". Do this in both IE and Firefox. The tables appear to me to...
3
by: ben.saur | last post by:
I am having a problem viewing a centered table using Firefox. When the page is long enough to scroll, the alignment moves slightly to the left. The alignment doesn't change when I view the page...
2
by: Joey | last post by:
Hello all, I have been designing a site where the main content is enclosed in one table, and that table needs to be centered (the centering is done by using another container such as a div or...
11
by: Serg | last post by:
I had some CSS problems, and they were solved by someone who pointed out to me that I should have <!DOCTYPE ..... at the top of my code, which I now do. And it fixed all the inheritance...
5
by: BACON | last post by:
I'm just starting the process of reorganising my modest little website and cleaning up all the HTML, and the logical place to begin was with the homepage. I made a simple little ASP.NET control...
5
by: MaxiWheat | last post by:
Hi, I would like to expose a situation that I would like to have informations about. Let's suppose I have a table that looks like this : <table cellspacing="0" cellpadding="0" border ="0">...
5
by: Markus Ernst | last post by:
Hello This is a test example: http://www.markusernst.ch/anthracite/ http://www.markusernst.ch/anthracite/living_divani.html After googling and experimenting for several hours, I ended up...
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...

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.