diff --git a/src/pydata_sphinx_theme/assets/styles/content/_tables.scss b/src/pydata_sphinx_theme/assets/styles/content/_tables.scss index b701323743..e6ae236f6e 100644 --- a/src/pydata_sphinx_theme/assets/styles/content/_tables.scss +++ b/src/pydata_sphinx_theme/assets/styles/content/_tables.scss @@ -55,3 +55,9 @@ td { --pst-color-text-base ); // ensure text and bullets are visible } + +.pst-scrollable-table-container { + // Put a scrollbar just below tables that are too wide to fit within the main + // column + overflow-x: auto; +} diff --git a/src/pydata_sphinx_theme/translator.py b/src/pydata_sphinx_theme/translator.py index e8ab9ea6e2..b42e141e0e 100644 --- a/src/pydata_sphinx_theme/translator.py +++ b/src/pydata_sphinx_theme/translator.py @@ -81,9 +81,17 @@ def visit_table(self, node): if "align" in node: classes.append(f'table-{node["align"]}') + # put table within a scrollable container (for tables that are too wide) + self.body.append('