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="#FFFFFF" 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 1788 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.
I see. I see the error in my design, but I've put quite a bit of time into this page. Is there any way to set a point for the page to open to? Or any other way to make this work?
AricC 1,892
Recognized Expert Top Contributor
I think the problem is with the widths of your page, you're not going to be centering something that is 2000px wide when your monitor doesn't have the capability to do so.
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...
|
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...
|
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...
| |
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...
|
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...
|
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:
...
|
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...
|
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...
| |
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,...
|
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: 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...
|
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: 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...
|
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 ...
| |
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...
| |