473,387 Members | 1,904 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.

text-align: right in Firefox

Hi!

When I put a table into a table and try to align it right, it works in IE
but not in Firefox.

Simplest code to reproduce:
<html>
<body>
<table style="width: 100%">
<tr>
<td style="width: 50%">
blabla
</td>
<td style="width: 50%; text-align:right;">
<table>
<tr><td>test</td></tr>
</table>
</td>
</tr>
</table>
</body>
</html>

How do I align it right "rightly". ;)

Regards, André

Jul 21 '05 #1
8 19977
Els
André Hänsel wrote:
Hi!

When I put a table into a table and try to align it right,
it works in IE but not in Firefox.

Simplest code to reproduce:
<html>
<body>
<table style="width: 100%">
<tr>
<td style="width: 50%">
blabla
</td>
<td style="width: 50%; text-align:right;">
<table>
<tr><td>test</td></tr>
</table>
</td>
</tr>
</table>
</body>
</html>

How do I align it right "rightly". ;)


table td table{float:right;}

--
Els
http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Jul 21 '05 #2
"André Hänsel" <an***@webkr.de> wrote:
When I put a table into a table and try to align it right, it works in IE
but not in Firefox.
Usually when people describe a problem that way, it's in reality Firefox
that gets things right and IE wrong.
<td style="width: 50%; text-align:right;">
<table>
<tr><td>test</td></tr>
</table>
</td>
The text-align property affects, by CSS specifications, the alignment of
text lines inside the element. The inner table is a block element, so it is
not affected. The text-align property is inherited into the inner td so the
line ultimately gets aligned to the right, but only within its container,
the cell, and the width of the container is here just as much as needed for
it. IE, as so often, gets this wrong.
How do I align it right "rightly". ;)


Using float: right as suggested by Els would be the technically appropriate
way, but what are you really trying to accomplish? It seems that you are
using tables for layout - nested tables are _mostly_ an indication of that.
Then you might just as well use <table align="right"> for the inner table.
Alternatively, you could try and implement the layout in CSS instead of a
mixed approach.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Jul 21 '05 #3
Jukka K. Korpela wrote:
"André Hänsel" <an***@webkr.de> wrote:
When I put a table into a table and try to align it right, it works
in IE but not in Firefox.
Usually when people describe a problem that way, it's in reality
Firefox that gets things right and IE wrong.


Yes, of course me and IE were wrong, that's why I asked how to do it right.
:)
The text-align property affects, by CSS specifications, the alignment
of text lines inside the element. The inner table is a block element,
so it is not affected. The text-align property is inherited into the
inner td so the line ultimately gets aligned to the right, but only
within its container, the cell, and the width of the container is
here just as much as needed for it. IE, as so often, gets this wrong.


By the way, so I got a nice description of my problem. ;)
How do I align it right "rightly". ;)


Using float: right as suggested by Els would be the technically
appropriate way, but what are you really trying to accomplish? It
seems that you are using tables for layout - nested tables are
_mostly_ an indication of that. Then you might just as well use
<table align="right"> for the inner table. Alternatively, you could
try and implement the layout in CSS instead of a mixed approach.


Yes, I'm using a table for layout... still an old vice. It's just one for
the overall layout of the page, but...

....probably I can also avoid even that.
I have one logo in the upper left corner, a box with a login form in the
upper right corner, the content in the middle and a footer line at the
bottom.
How does a correct CSS for that look like? Link?

Jul 21 '05 #4
Jukka K. Korpela wrote:
"André Hänsel" <an***@webkr.de> wrote:

When I put a table into a table and try to align it right, it works in IE
but not in Firefox.

[snip]
Using float: right as suggested by Els would be the technically appropriate
way, but what are you really trying to accomplish? It seems that you are
using tables for layout - nested tables are _mostly_ an indication of that.
As is using a table with one row and one column--that seems rather odd.
Then you might just as well use <table align="right"> for the inner table.
Alternatively, you could try and implement the layout in CSS instead of a
mixed approach.

Jul 21 '05 #5
Harlan Messinger wrote:
Jukka K. Korpela wrote:
"André Hänsel" <an***@webkr.de> wrote:
When I put a table into a table and try to align it right, it works
in IE but not in Firefox.


[snip]
Using float: right as suggested by Els would be the technically
appropriate way, but what are you really trying to accomplish? It
seems that you are using tables for layout - nested tables are
_mostly_ an indication of that.


As is using a table with one row and one column--that seems rather
odd.


What d'ya mean? ;)

Jul 21 '05 #6
André Hänsel wrote:
Harlan Messinger wrote:
Jukka K. Korpela wrote:
"André Hänsel" <an***@webkr.de> wrote:
When I put a table into a table and try to align it right, it works
in IE but not in Firefox.


[snip]

Using float: right as suggested by Els would be the technically
appropriate way, but what are you really trying to accomplish? It
seems that you are using tables for layout - nested tables are
_mostly_ an indication of that.


As is using a table with one row and one column--that seems rather
odd.

What d'ya mean? ;)


A table is a two-dimensional matrix of rows and columns (or even more
dimensions represented by a hierarchy of row and column headers and
subheaders). What do you think it means to have a table with one only
cell in it, as you do in your code?

<table>
<tr><td>test</td></tr>
</table>
Jul 21 '05 #7
Harlan Messinger wrote:
André Hänsel wrote:
Harlan Messinger wrote:
Jukka K. Korpela wrote:
"André Hänsel" <an***@webkr.de> wrote:
Using float: right as suggested by Els would be the technically
appropriate way, but what are you really trying to accomplish? It
seems that you are using tables for layout - nested tables are
_mostly_ an indication of that.

As is using a table with one row and one column--that seems rather
odd.


What d'ya mean? ;)


A table is a two-dimensional matrix of rows and columns (or even more
dimensions represented by a hierarchy of row and column headers and
subheaders). What do you think it means to have a table with one only
cell in it, as you do in your code?


Well, I could not imagine that it has any influence on the alignment of _the
table itself_, what is _in_ the table, so I used a table with only one cell.

Jul 21 '05 #8
You can also just set style="display: inline;" on the table. This will make the table act like text instead of its own block. That way if you want to center it later you can.

JT

:cool:

Hi!

When I put a table into a table and try to align it right, it works in IE
but not in Firefox.

Simplest code to reproduce:
<html>
<body>
<table style="width: 100%">
<tr>
<td style="width: 50%">
blabla
</td>
<td style="width: 50%; text-align:right;">
<table>
<tr><td>test</td></tr>
</table>
</td>
</tr>
</table>
</body>
</html>

How do I align it right "rightly". ;)

Regards, André
Jul 1 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: joes | last post by:
Hello there ! I rendering a PDF with XSLT using Xalan and FOP. I like to place in my article an image, so that the text is floating around the image. I tried several things but it didn't work so...
2
by: Macsicarr | last post by:
Hi All Wonder if you could help me. I have created a CMS system that allows the user to enter text and pic 'tags' for their own About us page, eg text.... text.... text.... text.......
2
by: Jiri Palecek | last post by:
I have a question on web authoring (probably HTML+CSS). Is it somehow possible to put two words above each other inside a paragraph so the result would be valid and render at least in Mozilla? I...
0
by: TadPole | last post by:
I am using FOP to create PDF documents. I have the problem where I need to create line of text on a document in a certain line (absolute position), then the rest of the text needs to follow...
4
by: Arif Çimen | last post by:
Hi to everybody, I have chnged a button text in design mode. But After compiling and executing the program the text of the button do not change to new value. Any Ideas? Thaks for helps.
14
by: Joe | last post by:
Hello All: I am trying to dynamically populate a web page with literal content and controls (textboxes and checkboxes (and eventually two buttons - the buttons do not appear in the code yet). I...
3
by: jweinberg1975 | last post by:
I would like for users to be able to select from a small number of options that come from a little drop down menu which then closes. .....
3
by: bbepristis | last post by:
Hey all I have this code that reads from one text file writes to another unless im on a certian line then it writes the new data however it only seems to do about 40 lines then quits and I cant...
3
by: jonniethecodeprince | last post by:
Hi all, I have trouble getting an array of data stored in a separate javascript file i.e. a file called books.js into a table of data for a .xhtml file. There are 50 Records in this file....
10
by: bluemountain | last post by:
Hi there, Iam new to python forms and programming too I had a text file where i need to extract few words of data from the header(which is of 3 lines) and search for the keyword TEXT1, TEXT2,...
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: 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...
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
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
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.