@@ -198,11 +198,8 @@ img {
198198 TABLES
199199 ============================================================ */
200200
201- /*
202- Base table styling (applies to markdown tables AND Pandas).
203- NOTE: we intentionally do NOT set width: 100% here so that
204- very wide tables can scroll inside their containers.
205- */
201+ /* Base table styling (for markdown tables AND Pandas DataFrames).
202+ NOTE: no width: 100% here so wide tables can scroll. */
206203table {
207204 border-collapse : collapse;
208205 border : 1px solid # d0d0d0 ; /* outer border */
@@ -237,7 +234,7 @@ table thead th {
237234
238235/*
239236 Make only Quarto/markdown tables fill the content width.
240- Pandas DataFrames use class= "dataframe" and will be excluded
237+ Pandas DataFrames have class "dataframe" and are excluded
241238 so they can scroll horizontally instead.
242239*/
243240.quarto-table table : not (.dataframe ) {
@@ -246,19 +243,22 @@ table thead th {
246243
247244
248245/* ============================================================
249- CAPTIONS
246+ CAPTIONS (FIX: DO NOT STYLE `table caption`)
250247 ============================================================ */
251248
252- /* Table captions: left-aligned, no special background */
249+ /*
250+ Quarto-generated table captions:
251+ - left-aligned
252+ - simple spacing
253+ IMPORTANT: We intentionally do NOT style `table caption`
254+ because that breaks scrolling for `.table.caption-top`
255+ tables like Pandas DataFrames.
256+ */
253257.quarto-float-tbl .quarto-float-caption ,
254258.quarto-float .quarto-float-caption ,
255- table caption {
259+ [ id ^= "tbl-" ][ id *= "- caption-" ] {
256260 text-align : left !important ;
257- width : 100% !important ;
258- display : block !important ;
259- box-sizing : border-box !important ;
260261 margin-bottom : 0.5em ;
261- padding : 0.4em 0 ; /* spacing only, no background color */
262262}
263263
264264
@@ -285,10 +285,7 @@ figure {
285285 margin-right : auto;
286286}
287287
288- /*
289- Figure captions:
290- - left-aligned text inside a horizontally centered figure.
291- */
288+ /* Figure captions: left-aligned inside centered figure */
292289.quarto-figure .figure-caption ,
293290.figure .figure-caption ,
294291figure figcaption {
@@ -343,19 +340,27 @@ figure figcaption {
343340 overflow-x : auto !important ;
344341}
345342
343+ /* Also allow scroll on the immediate inner wrapper div, just in case */
344+ .cell-output-display > div {
345+ max-width : 100% !important ;
346+ overflow-x : auto !important ;
347+ }
348+
346349/*
347- Pandas DataFrame tables (class="dataframe") should :
348- - Use intrinsic width (no stretching to 100%),
349- - Be allowed to be wider than their container;
350- the container scrolls horizontally .
350+ Pandas DataFrame tables have :
351+ class="dataframe ... table table-sm table-striped small"
352+ Bootstrap's `.table` sets width:100%; override that here so the
353+ DataFrame can be wider than the container and scrolls .
351354*/
352355.cell-output-display table .dataframe {
353- width : auto !important ;
356+ width : auto !important ; /* override Bootstrap's width: 100% */
354357 max-width : none !important ;
358+ display : table !important ;
355359}
356360
357- /* Handle the case where Pandas/Quarto wraps the dataframe in an extra div */
361+ /* Handle the nested case explicitly: <div><table class=" dataframe ..."></table></ div> */
358362.cell-output-display > div > table .dataframe {
359363 width : auto !important ;
360364 max-width : none !important ;
365+ display : table !important ;
361366}
0 commit comments