Q: Table cell style that uses CSS (and PDF SS) style name to get bg colour?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Q: Table cell style that uses CSS (and PDF SS) style name to get bg colour?

wolandscat
Subject says it all: I'm not clear on how to set table cell bg colour using a CSS cell class rather than just doing this:

4+^|*R E L E A S E{nbsp}{nbsp}{nbsp}{nbsp}{nbsp}1.0.2*
{set:cellbgcolor:aqua}

This is probably something simple, but I couldn't find it in the documentation.
Reply | Threaded
Open this post in threaded view
|

Re: Q: Table cell style that uses CSS (and PDF SS) style name to get bg colour?

mojavelinux
Administrator
Thomas,

To be clear, it's not currently possible to add a role to a table cell. This is something we've been discussing, but nothing has been implemented yet.


The {set:cellbgcolor:aqua} was merely an experiment and really should be avoided if possible because it's not very semantic.

I do recognize there are cases when adding a custom role to a table cell (to further format it) makes complete sense. However, I do encourage you to think about the fact that if this isn't done right or done to frequently, it can make the document look gaudy. As much as possible, we should avoid embellishing the output from the markup and leave that to the design phase. Mind you, I do understand that there are cases when such formatting is, in fact, semantic. I think a "results" cell is a good example.

-Dan

On Sat, Jul 11, 2015 at 3:57 AM, wolandscat [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Subject says it all: I'm not clear on how to set table cell bg colour using a CSS cell class rather than just doing this:

4+^|*R E L E A S E{nbsp}{nbsp}{nbsp}{nbsp}{nbsp}1.0.2*
{set:cellbgcolor:aqua}

This is probably something simple, but I couldn't find it in the documentation.


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Q-Table-cell-style-that-uses-CSS-and-PDF-SS-style-name-to-get-bg-colour-tp3490.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Reply | Threaded
Open this post in threaded view
|

Re: Q: Table cell style that uses CSS (and PDF SS) style name to get bg colour?

wolandscat
We have a standard use for this - see the amendment table here.

Scroll down a bit and you'll see spanning cells with Release xxx in them. Ignore the horrible cyan colour; it should be something decent, which is why I wanted to have a proper style.

In technical documents, shaded cells are very common. Another (probably better) example is here. The blue is used to make the table visually comprehensible, and is a common style in these kind of technical standards (not that specific colour obviously).
Reply | Threaded
Open this post in threaded view
|

Re: Q: Table cell style that uses CSS (and PDF SS) style name to get bg colour?

mojavelinux
Administrator

On Sat, Jul 11, 2015 at 4:47 PM, wolandscat [via Asciidoctor :: Discussion] <[hidden email]> wrote:
We have a standard use for this - see the amendment table here.

Scroll down a bit and you'll see spanning cells with Release xxx in them. Ignore the horrible cyan colour; it should be something decent, which is why I wanted to have a proper style.

In this case, those should simply be header cells (add the h style) and then style the <th> element inside of <tbody> for tables with this "amendments" role.

[.amendments, cols="1,6,2,2"]
|===
|Issue |Details |Raiser |Completed

|... |... |... |...

4+^h|Release 1.0.2

|... |... |... |...

|===

table.tableblock.amendments tbody th {
  text-transform: uppercase;
  letter-spacing: 2ex;
  background-color: cyan;
}

This way, you leave all the formatting hacks out of the AsciiDoc and move it to the styling language (CSS for HTML and the theme file for PDF).

Does that make sense?

Reply | Threaded
Open this post in threaded view
|

Re: Q: Table cell style that uses CSS (and PDF SS) style name to get bg colour?

mojavelinux
Administrator
In reply to this post by wolandscat

On Sat, Jul 11, 2015 at 4:47 PM, wolandscat [via Asciidoctor :: Discussion] <[hidden email]> wrote:
In technical documents, shaded cells are very common. Another (probably better) example is here. The blue is used to make the table visually comprehensible, and is a common style in these kind of technical standards (not that specific colour obviously).

Again, this is just a matter of styling header cells. The function of the cells is that they are header (or label) cells. The styling should be done in the styling language not in the AsciiDoc source, IMO.