executablebooks / sphinx-tabs

Tabbed views for Sphinx
https://sphinx-tabs.readthedocs.io
MIT License
265 stars 68 forks source link

👌 IMPROVE: Change CSS to remove extra white-space in panel #143

Closed foster999 closed 12 months ago

foster999 commented 3 years ago

Some themes pad paragraph elements with a bottom-margin. This change removes that margin when p element is within a panel.

Fixes #139

codecov[bot] commented 3 years ago

Codecov Report

Merging #143 (c104e79) into master (ade8d9c) will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #143   +/-   ##
=======================================
  Coverage   92.23%   92.23%           
=======================================
  Files           2        2           
  Lines         219      219           
=======================================
  Hits          202      202           
  Misses         17       17           
Flag Coverage Δ
pytests 92.23% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update ade8d9c...c104e79. Read the comment docs.

reiyw commented 2 years ago

I was just investigating this issue as well https://github.com/executablebooks/sphinx-tabs/issues/168. It turns out that removing the bottom margin of all p elements in a panel would break the spacing between content (at least in sphinx-rtd-theme).

On the master branch: image

With this change: image

Also, elements generated by the code-tab directive do not include the p element, so that CSS is not applied.

A way around these problems is to set the bottom margin for the last child of the element in the panel.

.sphinx-tabs .sphinx-tabs-panel *:last-child {
    margin-bottom: 0;
}

However, this breaks the spacing in the alabaster theme, as shown in https://github.com/executablebooks/sphinx-tabs/issues/168, so I think a more general solution is needed.