Centering table in Author Mode

Post here questions and problems related to editing and publishing DITA content.
tmakita
Posts: 104
Joined: Fri Apr 08, 2011 7:58 am

Centering table in Author Mode

Post by tmakita »

My user wants to center tables in Author Mode.
I've tried following CSS but it seems not work.

Code: Select all

*[class~='topic/table'][outputclass~='center']{
    margin: auto;
}
Do you have any suggestions?
Regards,
--
/*--------------------------------------------------
Toshihiko Makita
Development Group. Antenna House, Inc. Ina Branch
Web site:
http://www.antenna.co.jp/
http://www.antennahouse.com/
--------------------------------------------------*/
Radu
Posts: 9162
Joined: Fri Jul 09, 2004 5:18 pm

Re: Centering table in Author Mode

Post by Radu »

Hi,
Assuming your table has column widths which are fixed like this:

Code: Select all

<table frame="all" rowsep="1" colsep="1"
                id="table_ump_qnm_qbc" outputclass="center">
                <title>fds</title>
                <tgroup cols="2">
                    <colspec colname="c1" colnum="1" colwidth="75pt"/>
                    <colspec colname="c2" colnum="2" colwidth="75pt"/>
                    <thead>
                        <row>
                            <entry/>
                            <entry/>
                        </row>
                    </thead>
                    <tbody>
                        <row>
                            <entry/>
                            <entry/>
                        </row>
                    </tbody>
                </tgroup>
            </table>
something like this seems to work for me:

Code: Select all

*[class~='topic/table'][outputclass~='center']{
    margin: auto;
    width:10px;
}
It should work even without specifying that 10px width (which is not taken into account anyway as the colspecs are larger) but it does not work without specifying a width in the CSS.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
tmakita
Posts: 104
Joined: Fri Apr 08, 2011 7:58 am

Re: Centering table in Author Mode

Post by tmakita »

Thank you Radu!
It's a nice suggestion.
Regards,
--
/*--------------------------------------------------
Toshihiko Makita
Development Group. Antenna House, Inc. Ina Branch
Web site:
http://www.antenna.co.jp/
http://www.antennahouse.com/
--------------------------------------------------*/
Post Reply