table width

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

table width

timm
Hi,

I'm trying to get (HTML) tables which are as narrow as possible. By default, the table width is 100% and every column has the same width.
The table width is controlled by the 'table.spread' in the css, so I can overwrite that. But the column width is encoded in the html: e.g.

<colgroup>
<col style="width: 50%;">
<col style="width: 50%;">
</colgroup>

I my case, I would like to get rid of this colgroup or overwrite it, so that columns are only as wide as needed. Is this possible?

Best regards,
Tim
Reply | Threaded
Open this post in threaded view
|

Re: table width

mojavelinux
Administrator
Tim,

You can disable the 100% width on the tables using the %autowidth option.

[%autowidth]
|===
| A | B
|===

The percentages on the col tags only dictate relative widths. They add up to 100%, but they do not affect the table width (the values are relative of the calculated table width by the browser).

Cheers,

-Dan

On Wed, Nov 4, 2015 at 10:41 AM, timm [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hi,

I'm trying to get (HTML) tables which are as narrow as possible. By default, the table width is 100% and every column has the same width.
The table width is controlled by the 'table.spread' in the css, so I can overwrite that. But the column width is encoded in the html: e.g.

<colgroup>
<col style="width: 50%;">
<col style="width: 50%;">
</colgroup>

I my case, I would like to get rid of this colgroup or overwrite it, so that columns are only as wide as needed. Is this possible?

Best regards,
Tim


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/table-width-tp3940.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Dan Allen | @mojavelinux | http://google.com/profiles/dan.j.allen
Reply | Threaded
Open this post in threaded view
|

Re: table width

timm
Thanks,
That's exactly what I was looking for (somehow overlooked this in the manual).

Best regards and thanks for this great project,
Tim
Reply | Threaded
Open this post in threaded view
|

Re: table width

wolandscat
In reply to this post by mojavelinux
This default seems to have changed when I upgraded to Asciidoctor 2. The previous version rendered like in this doc: https://specifications.openehr.org/releases/RM/Release-1.0.4/common.html - the first table you see at the time (Doc Id block). A diff of the HTML shows this:

<table class="tableblock frame-all grid-all spread">   // ORIGINAL
<table class="tableblock frame-all grid-all stretch">   // Asciidoctor 2

Now it renders the table with autowidth cols, and on the left. Ideally I would have cols to accommodate the content and the table centred in the content area. I can find no way to do that - [cols="1,1",width=100%] doesn't work; neither does [align="center"], which the documentation says is not implemented, and [%autowidth.stretch] doesn't work either.

I even tried faking it by embedding this table in another one with invisible grid / frame, but to no avail.

How do I either get my table centered (1st preference) or stretched full-width (when it has limited contents)?
Reply | Threaded
Open this post in threaded view
|

Re: table width

wolandscat
I just discovered that [%autowidth.spread] does work - the manual says  [%autowidth.stretch], which does not work. Perhaps this is a documentation error?
Reply | Threaded
Open this post in threaded view
|

Re: table width

mojavelinux
Administrator
The name of the role changed in Asciidoctor 2 from spread to stretch to be consistent with terminology used in comparable systems. The correct term is stretch moving forward. The documentation is correct in that it reflects the current role name.

As this feature 100% relies on the stylesheet, you may need to update your styles if you have a custom stylesheet:


Best,

-Dan

On Sat, Dec 14, 2019 at 9:46 AM wolandscat [via Asciidoctor :: Discussion] <[hidden email]> wrote:
I just discovered that [%autowidth.spread] does work - the manual says  [%autowidth.stretch], which does not work. Perhaps this is a documentation error?



If you reply to this email, your message will be added to the discussion below:
https://discuss.asciidoctor.org/table-width-tp3940p7422.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux