Pages: 1
Print
Author Topic: Horizontal Alignment in tables (XMAX/XMetaL v6.5)  (Read 3643 times)
rewers08
Member

Posts: 9


« on: January 11, 2011, 06:19:14 AM »

Hi,

for our XMAX implementation we've adopted the HTML table structure in our XML Schema. Most of the things we need work fine. But now we are facing a problem with the horizontal alignment of table cells. As long as a table cell contains only text everything works and the text can be aligned left, center and right. But as soon as a table cell's first child is another XML element (and not plain text) we are having the problem that the element and all it's content is always aligned to the left. The attribute for the alignment is set properly. But the position is always left (tested in XMAX and XMetaL).

With the vertical alignment we are having NO problems. It's always shown the way it is set in the properties (tested in XMAX and XMetaL).

Any hints?

Greetings,
rewers08
Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 2606



WWW
« Reply #1 on: January 11, 2011, 03:28:33 PM »

I suspect you have inserted an element that is using CSS display:block inside the table cell. Elements with display:block set on them fill the available width of their container (ie: width - padding). Try inserting an element that does not have display:block set, or that specifically has display:inline (the default) set.

The align attribute in an HTML table cell is a hard coded behavior for rendering tables that is not connected directly to the CSS rendering engine, so the alignment behavior does not cascade down inside the content of child elements inside table cells. Perhaps that is what you are assuming the behavior will be.

In order to see the behavior that I assume you want you would need to add CSS similar to the following:

td[align="right"] * {
  text-align:right;
}

This is not necessary for inline elements because the entire element can be aligned to the right (which is what happens), since it does not always take up 100% of the width, so in that way it happens to act just like regular text, or an image, when inside a table cell. When you set the CSS above, the content of block elements is aligned to the right. This might not be really obvious, which is why I have created a third screen capture that includes a border around <Para> elements, which are styled block so you can see the element's boundary, and the content (the tags and the text).


* table_cell_alignment.jpg (122.35 KB, 1440x543 - viewed 628 times.)

* para_with_border.jpg (49.25 KB, 696x393 - viewed 622 times.)
« Last Edit: January 11, 2011, 03:31:16 PM by Derek Read » Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 2606



WWW
« Reply #2 on: January 11, 2011, 04:02:39 PM »

I just noticed that the version quoted is 6.5. There is no such version to date, so I assume you are either running 6.0 or 6.1.
Just wanted to add this for clarity in case someone else gets confused by that.
Logged
Pages: 1
Print
Jump to:  

email us