Page 1 of 1

Filling color in table cells

Posted: Fri Apr 27, 2018 10:00 am
by dpksaini89
How to fill colors in particular table cells.

Re: Filling color in table cells

Posted: Fri Apr 27, 2018 4:29 pm
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