I've read other posts on here about this issue and I've tried applying the code but I still can't get a centered table. Here is what I have:
In my CSS:
.centered-table {
margin-left: auto;
margin-right: auto;
}
In my HTML:
<body bgcolor="#FFFFF F" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0 ">
<div class="centered ">
<table class="centered-table" id="Table_01" width="2001" height="1001" border="0" cellpadding="0" cellspacing="0" >
</table>
</div>
If I need to include more code in order to figure this out let me know.
11 1800 kestrel 1,071
Recognized Expert Top Contributor
what i did with mine was put the class "centered" right into the <table> tag
what i did with mine was put the class "centered" right into the <table> tag
Good point. My programming is a little rusty. However, my table still won't center. I've tried viewing it in Safari and Firefox...
When you put a -
<div style='text-align:center'>
-
......
-
..... your table
-
.....
-
</div>
-
around it, it'll work.
Ronald :cool:
When you put a -
<div style='text-align:center'>
-
......
-
..... your table
-
.....
-
</div>
-
around it, it'll work.
Ronald :cool:
...no dice
To center the table, you should use css and
table{margin:0 auto;}
which is, essentially, what you have. However, the table is centered but this does not center the cell or the text inside. To do that you must enter this:
td{text-align:center}
To center the table, you should use css and
table{margin:0 auto;}
which is, essentially, what you have. However, the table is centered but this does not center the cell or the text inside. To do that you must enter this:
td{text-align:center}
Well the thing is that the table isn't centered, and I don't need to center the text.
AricC 1,892
Recognized Expert Top Contributor
I just did a test with the following code and it worked (IE, sorry no FF at work) if this isn't working you should post your code one thing to consider as DrHoward likes to point out is make sure your doctype is correct. - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-
"http://www.w3.org/TR/html4/strict.dtd">
-
<html>
-
<head>
-
<title>
-
Test
-
</title>
-
<style type="text/css">
-
table
-
{
-
margin-left: auto;
-
margin-right: auto;
-
border: 1px solid black;
-
height: 500px;
-
width: 500px
-
}
-
-
</style>
-
-
</head>
-
<body>
-
-
<table>
-
<tr>
-
<td>
-
Test
-
</td>
-
</tr>
-
</table>
-
</body>
ok here's all the code.
CSS= .centered {margin-left: auto; margin-right: auto;}
The code you had DID center the table. Perhaps the enormous width you give it is fooling you.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: john T |
last post by:
Is there anyway to vertically center a html table using css in such a
way it does not alter the html table. When I tryied it just screws up.
|
by: Neal |
last post by:
Patrick Griffiths weighs in on the CSS vs table layout debate in his blog
entry "Tables my ass" - http://www.htmldog.com/ptg/archives/000049.php . A
quite good article.
|
by: red |
last post by:
How do I center two side by side divs ?
I've been writing css pages for a while but there's one thing tha still
eludes me.
I can center a div with margin auto.
I can place two divs side by side with float.
But I can't center two side by side divs.
If I float them and give them auto margins, the auto margins are ignored.
If I wrap the two floated divs in another div, the two divs have no
|
by: Axel Siebenwirth |
last post by:
Hi,
as described at http://www.quirksmode.org/css/centering.html, I try to do
to centering with my site. I did exactly as told on that page but it only
seems to center horizontally.
My site is at http://www.up-2-d8.de/menu.html
Can you please take a look and see whether you can find anything I am
doing wrong?!
|
by: Gnolen |
last post by:
Hi again,
Last time my server was down(as for many others I have heard), but now
it is online again!
I would be really really happy if someone could take a look at my
problem a bit. I now have two problems...It is the difference between IE
and FF..
Problem #1.
| |
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 with IE. Here
is the code:
Table 1:
<table width="100%">
<tr><td >
<div align="center">
<table border="1" style="width:800; margin-left:auto;
|
by: Tantale |
last post by:
I used this serviec to check my webpage
http://www.jmrw.com/Abroad/Barcelone/index.htm Made with Dreamweaver 8.
The result is 206 errors, most of them "end tag omitted, but OMITTAG NO was
specified.".
I don't understand this result. Should I modify something ?
Thanks
|
by: Neal |
last post by:
http://www.brassattackofspringfield.com/gigs.html
CSS at http://www.brassattackofspringfield.com/default.css
Opera and IE render caption as desired. Firefox does not. Why? And is there
a fix?
|
by: SpaceMarine |
last post by:
hello,
i see that <table align="center"is no longer valid markup in XHTML.
nor is <center><table></table></center>.
how then does one center a table?
found articles for centering text:
http://msconline.maconstate.edu/Tutorials/XHTML/XHTML03/xhtml03-03.htm
|
by: =?Utf-8?B?ZnJhbmt5?= |
last post by:
Hello,
I've created a table that has two rows that are span across three columns.
The third row has three columns, each with an image. The last row is also
span accross three columns. The span rows are centering their data.
however, the row with three columns, each with images (myimages1-3) are not
centering with the rest of the table. Any idea why?
Thanks in advance!
|
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...
| |
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,...
|
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...
|
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,...
|
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();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |