Tables always left aligned. I want them centered

This forum is for all Flare issues not related to any of the other categories.
Post Reply
parsonsv
Sr. Propeller Head
Posts: 110
Joined: Fri Mar 23, 2007 12:30 pm
Location: Calgary, Alberta

Tables always left aligned. I want them centered

Post by parsonsv »

Humm, I'm a little confused. My tables in Flare appear centered, but when I build my output or even preview, the tables are left aligned.

I have a table style set up as DescrTable. In the Table Properties, I set the Align to Center. I then create a table in Flare and set the Table Properties so that the table uses my new table style. At that point, I also set the Align to Center. Viola. The table has my table style and appears centered in my project. But, when I build the table, this isn't the case. It's always left aligned.

Does anyone know what I'm doing wrong?
Victoria Clarke
KevinDAmery
Propellus Maximus
Posts: 1985
Joined: Tue Jan 23, 2007 8:18 am
Location: Darn, I knew I was around here somewhere...

Re: Tables always left aligned. I want them centered

Post by KevinDAmery »

Do you mean the table itself, or the text within it?

For the table itself relative to the page, I believe that is actually controlled by the Table tag in the main stylesheet (not the table stylesheet).
Until next time....
Image
Kevin Amery
Certified MAD for Flare
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Tables always left aligned. I want them centered

Post by LTinker68 »

Are you building to Word/Framemaker or to WebHelp? If you're building to WebHelp, then it should work. When you tell Flare to center the table, it applies an "auto" property to the left and right margins inline in the table tag, which in web output will cause it to be centered. That effect isn't recognized in Word, I don't believe (I don't have FM so I don't know if it works).

To center the table in print output, you can set the left/right margins for the table in print output if you have a set size for the table and know what the sizes of the margins should be. If you don't know what the margin sizes will be (the table width is set by the content), then create a custom <p> class and set its text-align property to center. Then insert the table inside that custom <p> class. I believe that'll work (don't have Flare running at the moment to test it).
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
parsonsv
Sr. Propeller Head
Posts: 110
Joined: Fri Mar 23, 2007 12:30 pm
Location: Calgary, Alberta

Re: Tables always left aligned. I want them centered

Post by parsonsv »

I'm publishing to WebHelp, and I couldn't find a location in the Table entry in the main stylesheet that controlled the centering of tables. Maybe you can point me in in the right direction?

As for it automatically centering when I build my project - that's the problem, it isn't. I just don't know why. I've set the table properties to center, and it does center the table in Flare. However, when I build the project and run the WebHelp, the table is left aligned. I must have messed something up somewhere. Ugh.

Any ideas?
Victoria Clarke
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Tables always left aligned. I want them centered

Post by LTinker68 »

To be honest, I usually just open the topic in the Internal Text Editor and add align="center" to the table tag. It's actually being deprecated by the W3C, but it still works in the browsers. You might want to open the topic in the Internal Text Editor anyway to see what inline styles have been added to the table -- there may be a style inline that's giving you problems.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
parsonsv
Sr. Propeller Head
Posts: 110
Joined: Fri Mar 23, 2007 12:30 pm
Location: Calgary, Alberta

Re: Tables always left aligned. I want them centered

Post by parsonsv »

So Ltinker - does that mean your tables are always left aligned too unless you go in and add the center tag? Here is the code for my table. I left it empty to make it easier to read. See anything here?

<table class="TableStyle_DescrTable" style="mc-table-style: url('../../../Resources/TableStyles/DescrTable.css');margin-left: auto;margin-right: auto;" cellspacing="0">
<col style="width: 125px;" />
<col style="width: 125px;" />
<thead>
<tr>
<th class="TableStyle_DescrTable_Head_0_0_RowSep_ColSep"> </th>
<th class="TableStyle_DescrTable_Head_0_0_RowSep_ColEnd"> </th>
</tr>
</thead>
<tbody>
<tr>
<td class="TableStyle_DescrTable_Body_0_0_RowEnd_ColSep"> </td>
<td class="TableStyle_DescrTable_Body_0_0_RowEnd_ColEnd"> </td>
</tr>
</tbody>
</table>
Victoria Clarke
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Tables always left aligned. I want them centered

Post by LTinker68 »

parsonsv wrote:does that mean your tables are always left aligned too unless you go in and add the center tag?
Yes. When I insert the table I usually leave the default positioning in place because most of my tables are 100% width. For tables with less info, I'll either add the center alignment manually, or I'll put the table inside a <div> tag that has text-align set to center.

parsonsv wrote:<table class="TableStyle_DescrTable" style="mc-table-style: url('../../../Resources/TableStyles/DescrTable.css');margin-left: auto;margin-right: auto;" cellspacing="0">
The auto margins on the table should work if the table has no parent tag other than the body tag. (If it's inside a <p> or <div> tag, for example, then it'll adjust the margin based on the parent tag's width, although I'm not entirely sure that is followed properly by IE.) Did you try it in both Internet Explorer and Firefox? It seems to me like I decided to manually center the table or put it inside a div tag because one of the browsers had a problem with the auto-margin property on a table. Works fine if you use auto-margin on a div, but doesn't like it on a table. At least, from what I've observed (and remember -- don't have Flare running at the moment).
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
parsonsv
Sr. Propeller Head
Posts: 110
Joined: Fri Mar 23, 2007 12:30 pm
Location: Calgary, Alberta

Re: Tables always left aligned. I want them centered

Post by parsonsv »

Yes, the table is directly on the Body tag. Oh well, I've adjusted the table to auto-fit the window at 100%. I was hoping to fit to contents and center, but if I have to manually apply a tag at each table, that's just too much work.

I write for IE. I don't even have Firefox installed. My reasoning is that Firefox seems really stable and fantastic, and all the problems seem to happen in IE, so if I can make it work in IE, then the rest is gravy... :)

Thanks for your help! - Again.
Victoria Clarke
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Tables always left aligned. I want them centered

Post by LTinker68 »

Unfortunately, Flare automatically puts inline styles in the table tag if you use its interface to specify a position other than default. If you tell it to center the table, then it applies the margin-left:auto and margin-right:auto styles to the tag. If you set the table position to left, then it puts in a margin-left:0 and margin-right:auto styles in the tag. These inline styles will override anything set in the stylesheet and even in a container tag if you try to go that route.

If centering is something you're going to do with every table, then do this... (Note: Oddly enough, this doesn't work in FF but does work in IE6. You'll have to test it in IE7 to see if it still works.)

In the stylesheet, create a DIV class called tableContainer. Set its text-align to center. In the topic, on a new line, click the indent icon in the toolbar. Select div.tableContainer from the screen that appears. To go Table > Insert and create the table. Make sure to set the table position to default. Fill in the data, save the topic, and build the project (make sure you clean out the output folder so that IE doesn't pull the cached output).

As I said, worked in IE6, but it didn't work in FF, so make sure you test it in IE7. On the other hand, FF handled the margin-left:auto and margin-right:auto styles correctly, so IE7 might, too, but IE6 didn't work with those styles, so IE7 might not either. Which IE are you testing in?
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
parsonsv
Sr. Propeller Head
Posts: 110
Joined: Fri Mar 23, 2007 12:30 pm
Location: Calgary, Alberta

Re: Tables always left aligned. I want them centered

Post by parsonsv »

I'm working in IE7, and it doesn't handle the auto left and right - still left aligned even though I set it to center.

Your div style solution is interesting, though I am sad the style doesn't work in both ie and ff, considering about 16% or something of users actually use ff now. I'll give it a shot.

Thanks again - your advice is awesome
Victoria Clarke
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Tables always left aligned. I want them centered

Post by LTinker68 »

What do you know, there is a way to have your cake and eat it, too! :P

If you combine the solutions, then you'll get an effect that works in both IE and FF. (You'll have to test it in IE7.) Have a DIV class with the text-align set to center, and inside that div, create a table with the positioning set to center (left-margin:auto and right-margin: auto). IE6 responds to the centered DIV and FF responds to the auto margins on the table.

I know there are styles that you can add to the stylesheet that seem to be contradictory but that work because one browser follows one line of the style and the other browser follows the second line. It didn't occur to me until just now to see if it would work by mixing tags, but apparently it does.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
i-tietz
Propellus Maximus
Posts: 1219
Joined: Wed Oct 24, 2007 4:13 am
Location: Fürth, Germany

Re: Tables always left aligned. I want them centered

Post by i-tietz »

For problems like that (style working for IE? for FF? in what way?) I usually consult a German website called selfhtml.
There's bound to be an English equivalent!?
parsonsv
Sr. Propeller Head
Posts: 110
Joined: Fri Mar 23, 2007 12:30 pm
Location: Calgary, Alberta

Re: Tables always left aligned. I want them centered

Post by parsonsv »

LTinker68 wrote:Have a DIV class with the text-align set to center, and inside that div, create a table with the positioning set to center (left-margin:auto and right-margin: auto).
Thanks for your help. Creating a Div tag with the property Center definitly works when directly off the Body tag. Now, I'm wondering if you can help with bullets. You see, some of my topics have main sections all in toggles. Then, some of those sections have toggles. So, two levels of toggles... Ok, the main toggle will open and close all the information in its section, unless I've expanded any of the toggles in the second level. In that case, those toggles stay open, even when the other information is hidden. The workaround we received from MadCap is to take the toggled information and create a P class within a list so that the toggled information is on a tag other than the main body. If I do that, the information will close when I toggle the main one. Hopefully I haven't lost you at this point!

The problem with the Div Center is that I can get that to work in the body tag, but if I create a P tag on a bullet and then try to add the Div Center tag to it, I'm not able to do it. The style (which I called Div.Center), doesn't appear in the style list, and when I click indent to automatically open the Div list, I'm told that the Current Selection Cannot be Grouped, i.e. found no tag type that can contain the selected items.

Do you know if I can apply the Div Center tag to a bulleted item? Sometimes I have tables that follow a bullet.

Here is a sample of the code I'm talking about (left empty for clarity).

<ul>
<li>Bullet 1</li>
<li>Bullet 2 (a toggle would be here for the following table)</li>
<p>Table goes here</p>
</ul>
Victoria Clarke
KevinDAmery
Propellus Maximus
Posts: 1985
Joined: Tue Jan 23, 2007 8:18 am
Location: Darn, I knew I was around here somewhere...

Re: Tables always left aligned. I want them centered

Post by KevinDAmery »

I don't think you can nest DIVs inside P or LI tags (although I could be wrong).
Until next time....
Image
Kevin Amery
Certified MAD for Flare
parsonsv
Sr. Propeller Head
Posts: 110
Joined: Fri Mar 23, 2007 12:30 pm
Location: Calgary, Alberta

Re: Tables always left aligned. I want them centered

Post by parsonsv »

You're right, it does replace the P tag, but as long as it's on the body tag, it works. This is probably the same reasoning though why I can't embed it in a list - it takes over the list tag.

Here is the coding for using div to center a table on the body.
1) Start with a P tag
2) Insert the table, and while the table is still selected, click Indent to apply your Div-Center property

<div class="center">
<table class="TableStyle_DescrTable" style="mc-table-style: url('../Resources/TableStyles/DescrTable.css');margin-left: auto;margin-right: auto;" cellspacing="0">
<thead>
<tr>
<th class="TableStyle_DescrTable_Head_0_0_RowSep_ColSep">Heading Left</th>
<th class="TableStyle_DescrTable_Head_0_0_RowSep_ColEnd">Heading Right</th>
</tr>
</thead>
<tbody>
<tr>
<td class="TableStyle_DescrTable_Body_0_0_RowEnd_ColSep">Cell Body Left</td>
<td class="TableStyle_DescrTable_Body_0_0_RowEnd_ColEnd">Cell Body Right</td>
</tr>
</tbody>
</table>
</div>
Victoria Clarke
KevinDAmery
Propellus Maximus
Posts: 1985
Joined: Tue Jan 23, 2007 8:18 am
Location: Darn, I knew I was around here somewhere...

Re: Tables always left aligned. I want them centered

Post by KevinDAmery »

Ok, let's back up a step: why do you want to apply the DIV Center to a P or LI tag in the first place? If it's just for horizontal alignment, why not make a separate P and / or LI class that you can use on the togglers to apply centered alignment?

The Div approach makes perfect sense for aligning a table, but I think it's unnecessary overkill for single-tag content like P and LI blocks.
Until next time....
Image
Kevin Amery
Certified MAD for Flare
parsonsv
Sr. Propeller Head
Posts: 110
Joined: Fri Mar 23, 2007 12:30 pm
Location: Calgary, Alberta

Re: Tables always left aligned. I want them centered

Post by parsonsv »

parsonsv wrote:Now, I'm wondering if you can help with bullets. You see, some of my topics have main sections all in toggles. Then, some of those sections have toggles. So, two levels of toggles... Ok, the main toggle will open and close all the information in its section, unless I've expanded any of the toggles in the second level. In that case, those toggles stay open, even when the other information is hidden. The workaround we received from MadCap is to take the toggled information and create a P class within a list so that the toggled information is on a tag other than the main body. If I do that, the information will close when I toggle the main one. Hopefully I haven't lost you at this point!

The problem with the Div Center is that I can get that to work in the body tag, but if I create a P tag on a bullet and then try to add the Div Center tag to it, I'm not able to do it. The style (which I called Div.Center), doesn't appear in the style list, and when I click indent to automatically open the Div list, I'm told that the Current Selection Cannot be Grouped, i.e. found no tag type that can contain the selected items.

Do you know if I can apply the Div Center tag to a bulleted item? Sometimes I have tables that follow a bullet.

Here is a sample of the code I'm talking about (left empty for clarity).

<ul>
<li>Bullet 1</li>
<li>Bullet 2 (a toggle would be here for the following table)</li>
<p>Table goes here</p>
</ul>
It's to align a table that's embedded in a list.
Victoria Clarke
KevinDAmery
Propellus Maximus
Posts: 1985
Joined: Tue Jan 23, 2007 8:18 am
Location: Darn, I knew I was around here somewhere...

Re: Tables always left aligned. I want them centered

Post by KevinDAmery »

Ok - what happens if you center the P or LI that contains the table?
Until next time....
Image
Kevin Amery
Certified MAD for Flare
parsonsv
Sr. Propeller Head
Posts: 110
Joined: Fri Mar 23, 2007 12:30 pm
Location: Calgary, Alberta

Re: Tables always left aligned. I want them centered

Post by parsonsv »

The table is left aligned
Victoria Clarke
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Tables always left aligned. I want them centered

Post by LTinker68 »

parsonsv wrote:Ok, the main toggle will open and close all the information in its section, unless I've expanded any of the toggles in the second level. In that case, those toggles stay open, even when the other information is hidden. The workaround we received from MadCap is to take the toggled information and create a P class within a list so that the toggled information is on a tag other than the main body. If I do that, the information will close when I toggle the main one. Hopefully I haven't lost you at this point!
I reported something similar awhile ago. The toggle is actually what it sounds like -- it toggles content, which means your only choices are open or closed. If a single toggle is open (e.g., "View the screenshot") and another toggle is clicked (e.g., "View all screenshots"), then the first toggle will close but all the others will open. I put in a feature request to have the toggles treated more like the "layer" effects in websites where you can "hide" or "show" a "layer" (aka, a div) and you can set it up so that ToggleA, for example, shows the contents of ToggleA only, but ToggleAll could show the contents of ToggleA, ToggleB, ToggleC, etc., even if the content of one or more of those toggles are already shown.
parsonsv wrote:The problem with the Div Center is that I can get that to work in the body tag, but if I create a P tag on a bullet and then try to add the Div Center tag to it, I'm not able to do it.
Try putting the <div> inside the <li>, not apply the div's class to the li. So it would look like:

Code: Select all

<ul>
   <li>text</li>
   <li>text</li>
   <li>
     <div class="center">
         <table>....</table>
     </div>
   </li>
</ul>
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
parsonsv
Sr. Propeller Head
Posts: 110
Joined: Fri Mar 23, 2007 12:30 pm
Location: Calgary, Alberta

Re: Tables always left aligned. I want them centered

Post by parsonsv »

LTinker68 wrote:Try putting the <div> inside the <li>, not apply the div's class to the li.
Is that a manual tag? In other words, do I have to open each topic in the text editor and add that div if I want to include it?
Victoria Clarke
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Tables always left aligned. I want them centered

Post by LTinker68 »

Unfortunately, I think so. The only way I know to insert a DIV in Flare is to click the indent icon, and when you do that in a list it creates a new embedded list instead of giving you the option to insert a div. I think we need a feature request for an easier way to insert div tags.

I was playing around with a snippet to see if you could one up with a blank table inside a div and then insert that snippet into a list, and it worked to an extent, but it didn't preserve the width of the table -- it limited to the amount of text on the list item above it. I didn't play around with it much so there might be a way to get it to work, but honestly, I personally wouldn't try to embed the table inside the list. I'd have the list stop before the table, insert the table (inside its div), then start a new list and have it continue numbering from the previous list. Others in the forum have used the "insert paragraph" option or whatever it's called into a list, so there may be a way to do that and convert the paragraph to a div, but personally, I just break the list.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
parsonsv
Sr. Propeller Head
Posts: 110
Joined: Fri Mar 23, 2007 12:30 pm
Location: Calgary, Alberta

Re: Tables always left aligned. I want them centered

Post by parsonsv »

I guess we've pushed it to it's limit hey!! :) Thank you so much for taking the time to offer advice; it's really helped.
Victoria Clarke
Post Reply