Filling color in table cells

Post here questions and problems related to editing and publishing DITA content.
dpksaini89
Posts: 66
Joined: Thu Feb 08, 2018 2:44 pm

Filling color in table cells

Post by dpksaini89 »

How to fill colors in particular table cells.
Costin
Posts: 833
Joined: Mon Dec 05, 2011 6:04 pm

Re: Filling color in table cells

Post by Costin »

Hello,

You could change the color of specific table cells, by setting an "@outputclass" attribute on the specific cells (specific <entry> elements) you need to customize.
Then, you should create a custom .css file containing the rules to match the specific classes used as outputclass.
For example, if you have the following DITA table (notice the <entry outputclass="test">Chrysanthemum</entry> element):

Code: Select all

<table frame="none">
<title>Flowers</title>
<tgroup cols="3">
<colspec colname="c1" colnum="1" colwidth="171.0pt"/>
<colspec colname="c2" colnum="2" colwidth="99.0pt"/>
<colspec colname="newCol3" colnum="3" colwidth="200px"/>
<thead>
<row>
<entry>Flower</entry>
<entry>Type</entry>
<entry>Soil</entry>
</row>
</thead>
<tbody>
<row>
<entry outputclass="test">Chrysanthemum</entry>
<entry>perennial</entry>
<entry>well drained</entry>
</row>
<row>
<entry>Gardenia</entry>
<entry>perennial</entry>
<entry>acidic</entry>
</row>
<row>
<entry>Gerbera</entry>
<entry>annual</entry>
<entry>sandy, well-drained</entry>
</row>
</tbody>
</tgroup>
</table>
you need the following CSS snippet:

Code: Select all

entry[outputclass=test] {
background-color:red;
}
Regards,
Costin
Costin Sandoi
oXygen XML Editor and Author Support
Post Reply