MDAnalysis / mdanalysis-sphinx-theme

The official MDAnalysis Sphinx documentation theme.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Are table width examples correct?

IAlibay opened this issue · comments

Maybe I don't understand how sphinx widths work, but if we look here; https://www.mdanalysis.org/mdanalysis-sphinx-theme/PR32/additional_samples.html#list-tables

It seems like the 50% width table is larger than alleged 100% width table, is this correct?

If the one above is is the 100% width table, I think the difference is that the 50% width sets width: 50% but the above one sets max-width: 100%. The actual width is free to vary.

The table styling in general is not super nice though, I'd like to change it! I think most of the styling is from sphinx-rtd-theme.

If the one above is is the 100% width table, I think the difference is that the 50% width sets width: 50% but the above one sets max-width: 100%. The actual width is free to vary.

Unfortunately I'm not sure if I'm just being real unless and can't understand what you mean, or if there's just a key bit of information missing from that explanation.

CSS has the min-width, width, and max-widths of an element. If width is specified, the element is set to that width as a default. If it's not set, as it is for the general list-table shown here, then the element can have any width between min-width and max-width. The actual width is then controlled by the widths of the elements inside, in this case the actual items in the table. Because "Item 1" and "Item 2" are relatively short strings, the top table in practice ends up quite narrow, despite being allowed to have widths of up to 100%.

I edited the text inside the tables to give a better idea -- the lower table still takes up 50% the space even though the text inside is quite short, and the table above is allowed to expand to 100%. (Note -- the width:50% table is still allowed to expand if the text is super long, since it doesn't have a max-width iirc.).

Screenshot 2023-09-04 at 10 18 40 am

That being said if different styling would be preferred, we should definitely adjust it!

I see, thanks for the explanation @lilyminium.

I personally don't hate the styling, at least it's stuff that's reasonably expected? (I know I set widths manually in a couple places in tthe mdakit registry).

I'll close as addressed?