DITA to PDF Using HTML5 and CSS: Table Cell or Row Shading
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 53
- Joined: Sat May 22, 2021 6:04 pm
DITA to PDF Using HTML5 and CSS: Table Cell or Row Shading
Post by patjporter »
Hello,
Can you please tell me how I would:
(a) Alternate shading of rows for contrast...one row no shading, next row, light grey shading, next row no shading, next row light grey shading, etc.?
(b) How would I selectively shade a cell or row with a background of light grey (or any other color)?
Thank you!
Pat
Can you please tell me how I would:
(a) Alternate shading of rows for contrast...one row no shading, next row, light grey shading, next row no shading, next row light grey shading, etc.?
(b) How would I selectively shade a cell or row with a background of light grey (or any other color)?
Thank you!
Pat
Re: DITA to PDF Using HTML5 and CSS: Table Cell or Row Shading
You can use the nth-child(odd) selector. For example:
To selectively set a background color for a row, you can set the DITA outputclass attribute on the element, with a class value that you can
match in the CSS:
Or more generic, to match other elements than rows and cell entries:
Many regards,
Dan
Code: Select all
*[class ~= "topic/tbody"] > *[class ~= "topic/row"]:nth-child(odd){
background-color: #EDEDED;
}
match in the CSS:
Code: Select all
<row outputclass="myClass">
<entry> ....
Code: Select all
*[class ~= "topic/tbody"] > *[class ~= "topic/row"][class~="myClass"]{
background-color:yellow;
}
*[class ~= "topic/tbody"] > *[class ~= "topic/entry"][class~="myClass"]{
background-color:yellow;
}
Code: Select all
*[class~="different"]{
background-color:yellow !important;
}
Dan
Return to “DITA (Editing and Publishing DITA Content)”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service