fix(python): Fix _repr_html_ double-height rows (#5645) #6534
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #5645
I've only changed the CSS:
removed
white-space: pre
- the rule causing double-height rowsremoved
scoped
from<style scoped>
attribute. It was dropped, no current browser implements it - https://stackoverflow.com/a/45692033renamed
.dataframe
class to.pl-dataframe
to prevent interactions with Pandas which also uses.dataframe
. The interaction can be observed: addcolor: red
to Polars HTML and you'll see the Pandas output change too.removed
th:only-of-type
rule,only-of-type
is not used by Polars (only Pandas).removed
tbody tr th
rule, not used by Polars, possibly used by Pandas multi-index.replace descendant selector (
thead tr th
) with child selector (thead > tr > th
) - CSS best practiceremoved VS Code bug workaround, and
line-height: 95%
rule.Note that current Pandas styling is very similar to this PR.
Rows can be made more condensed (less vertical padding) by adding something like below. This is a visual design issue, not for me to decide.
Very condensed (no vertical padding):
More condensed (less vertical padding):
BEFORE:
AFTER: