New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow table striping to be controlled by role or attribute #1365
Comments
You can add the following CSS to a docinfo file to get this behavior today: <style>
/* disable the default striping of rows */
table tr.even, table tr.alt, table tr:nth-of-type(even) {
background: none
}
/* stripe even rows only when the "striped" CSS class is used */
table.striped tr.even, table.striped tr.alt, table.striped tr:nth-of-type(even) {
background: #f8f8f7;
}
</style> You could also invert the shading so that it colors the odd rows instead of the even rows: <style>
/* disable the default striping of rows */
table tr.even, table tr.alt, table tr:nth-of-type(even) {
background: none
}
/* stripe odd rows only when the "striped" CSS class is used */
table.striped tr.odd, table.striped tr.alt, table.striped tr:nth-of-type(odd) {
background: #f8f8f7;
}
</style> Note that Asciidoctor doesn't actually use the "even", "odd" or "alt" CSS classes. Those are just present for completeness (in case you use them in other regions of your web page). |
Would like this somehow in asciidoctor-pdf also |
@dsisnero It is already possible to do so in the whole document (but not on a specific table) by modifying the theme. even_row_background_color: f9f9f9 under the section |
Exactly. See https://github.com/asciidoctor/asciidoctor-pdf/blob/master/docs/theming-guide.adoc#table for more info. |
It is already present in asciidoctor-pdf. I repetead the logic to match that. Changed default stripes background color to match asciidoctor default styles. Also added posiblity to define own color through 'stripesbgcolor' document attribute. Fixes asciidoctor#1365
It is already present in asciidoctor-pdf. I repetead the logic to match that. Changed default stripes background color to match asciidoctor default styles. Also added posiblity to define own color through 'stripesbgcolor' document attribute. Fixes asciidoctor#1365
It is already present in asciidoctor-pdf. I repetead the logic to match that. Changed default stripes background color to match asciidoctor default styles. Also added posiblity to define own color through 'stripesbgcolor' document attribute. Fixes asciidoctor#1365
It is already present in asciidoctor-pdf. I repetead the logic to match that. Changed default stripes background color to match asciidoctor default styles. Also added posiblity to define own color through 'stripesbgcolor' document attribute. Fixes asciidoctor#1365
It is already present in asciidoctor-pdf. I repetead the logic to match that. Changed default stripes background color to match asciidoctor default styles. Also added posiblity to define own color through 'stripesbgcolor' document attribute. Fixes asciidoctor#1365
It is already present in asciidoctor-pdf. I repetead the logic to match that. Changed default stripes background color to match asciidoctor default styles. Also added posiblity to define own color through 'stripesbgcolor' document attribute. Fixes asciidoctor#1365
It is already present in asciidoctor-pdf. I repetead the logic to match that. Changed default stripes background color to match asciidoctor default styles. Also added posiblity to define own color through 'stripesbgcolor' document attribute. Fixes asciidoctor#1365
…stripe option on table - valid values are even, odd, all, and none - not set by default; implies stripes on even rows - requires support from stylesheet
I think the option should be named "stripe" to be congruent with the frame and grid options. The CSS classes should also follow suite. It's possible to control this behavior either using the option or the role directly. After all, the option just sets the role.
I don't add the role by default to reduce bloat. If we decide it should be added by default (like with frame and grid), I can update the PR. |
In the end, I decided to go back to the plural form, "stripes", as I think this is more parallel and natural.
|
Good decision because asciidoctor-pdf is using |
Hello. Shouldn't the |
This feature is now documented in the User Manual. |
Allow the striping of table rows (alternating colors) to be controlled by either a role or attribute.
To be consistent with how the borders are handled, the attribute might make the most sense.
Though, we could disable it by default and allow it to be enabled using a role:
This would be similar to how Bootstrap works. See http://getbootstrap.com/css/#tables-striped.
As a side note, hovered rows might be interesting too. This may tip the scale towards using roles.
The text was updated successfully, but these errors were encountered: