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

CSS XHTML Firefox Right-Align Table

I can center a table in any browser using:

<div style="text-align:center">
<table border="1" style="width: 50%; margin:0 auto">
<tr><td>etc</td></tr>
</table>
</div>

But I can't figure out how to right-align the table. I don't want to use deprecated align= in the <table> tag.

TIA for any clues.
Mar 24 '07 #1
4 11011
AricC
1,892 Expert 1GB
I can center a table in any browser using:

<div style="text-align:center">
<table border="1" style="width: 50%; margin:0 auto">
<tr><td>etc</td></tr>
</table>
</div>

But I can't figure out how to right-align the table. I don't want to use deprecated align= in the <table> tag.

TIA for any clues.
Is the table centering? Try text-align: right in your div and get rid of the margin:0 auto in your table tag.
Mar 24 '07 #2
Is the table centering? Try text-align: right in your div and get rid of the margin:0 auto in your table tag.
Yes, the centering is fine. I just can't get it to right-align. I tried what you suggested (below) but it won't right-align in Firefox:

<div style="text-align:right;">
<table border="1" style="width: 50%;">
<tr>
<td>cell</td>
<td>cell</td>
<td>cell</td>
</tr>
</table>
</div>

I can get it to right-align as below, but it only right-aligns in Firefox that way:

<div style="text-align:-moz-right;">
<table border="1" style="width: 50%;">
<tr>
<td>cell</td>
<td>cell</td>
<td>cell</td>
</tr>
</table>
</div>

The -moz-right is also flagged as invalid CSS in my code editor. The closest I've gotten so far is to try to display the table inline as below, but it makes the table look weird.

<div style="text-align:right;">
<table border="0" style="width: 50%; display:inline">
<tr>
<td>cell</td>
<td>cell</td>
<td>cell</td>
</tr>
</table>
</div>
Mar 24 '07 #3
drhowarddrfine
7,435 Expert 4TB
Do this:
<div>
<table border="0" style="width: 50%; float:right">
<tr>
<td>cell</td>
<td>cell</td>
<td>cell</td>
</tr>
</table>
</div>
Mar 24 '07 #4
Do this:
<div>
<table border="0" style="width: 50%; float:right">
<tr>
<td>cell</td>
<td>cell</td>
<td>cell</td>
</tr>
</table>
</div>
That did it, thanks!
Mar 25 '07 #5

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

Similar topics

32
by: jp29 | last post by:
My take on problems composing, serving and rendering XHTML documents/web pages: 1. Typical conscientious web authors are producing XHTML documents (Web pages) that feature valid Markup and with...
9
by: James Pickering | last post by:
(update with re-formulated PHP) The W3C Tutorial relating to content negotiation http://www.w3.org/2003/01/xhtml-mimetype/content-negotiation mostly relates to Apache. I am working on...
16
by: Mcginkel | last post by:
I am trying to find a way to load XHTML content in an Iframe. I use to do this in html by using the following code : var iframeObject = document.createElement("iframe");...
23
by: Gustaf | last post by:
I just read this article from today: http://webstandards.org/buzz/archive/2005_09.html I need some help understanding this sentense: The W3C recommends XHTML 1.1 should be served with the...
2
by: Eric Lindsay | last post by:
Is this still the right place to discuss pages written in XHTML+XML and whether browsers treat them as XML or as HTML? I realise that Internet Explorer doesn't like XHTML pages served as...
24
by: Dan Jacobson | last post by:
I shall jump on the XHTML bandwagon. I run my perfectly good html4/strict pages thru $ tidy -asxhtml -utf8 #to get: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"...
1
by: Mellow Crow | last post by:
Just discovered something useful to share. From Firefox 1.5 in memory caching is used. The onload event only fires when the page first loads and not when the user navigates away and back to the...
6
by: sonic | last post by:
Ok, i am sure everyone is sick of hearing about this. but i've checked about 10 different posts/sites about this issue, and they all say "use DOM" but i think there is more to be said. Perhaps I...
15
by: Lennart | last post by:
Hi folks, I have created an animated image gallery in dhtml. It works fine in Internet Explorer. In Firefox, it only works if I ommit the DOCTYPE tag. The page is valid xhtml-strict but with a...
10
by: Robert Huff | last post by:
Can someone offer suggestions why, on the same server (Apache 2.2.8), this works <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html lang="en-US"> <head> <link rel=stylesheet...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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...
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.