From b6a1724264c4b4937d973eb73a0472ce9023e291 Mon Sep 17 00:00:00 2001 From: "Tomas R." Date: Tue, 4 Feb 2025 13:50:41 +0100 Subject: [PATCH] Make sidebar width more flexible (#218) --- python_docs_theme/static/pydoctheme.css | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/python_docs_theme/static/pydoctheme.css b/python_docs_theme/static/pydoctheme.css index bf92e92..8b7b2cf 100644 --- a/python_docs_theme/static/pydoctheme.css +++ b/python_docs_theme/static/pydoctheme.css @@ -140,6 +140,8 @@ span.pre { } div.sphinxsidebar { + display: flex; + width: min(25vw, 350px); float: none; position: sticky; top: 0; @@ -156,13 +158,17 @@ div.sphinxsidebar h4 { margin-top: 1.5em; } +div.bodywrapper { + margin-left: min(25vw, 350px); +} + div.sphinxsidebarwrapper { - width: 217px; box-sizing: border-box; height: 100%; overflow-x: hidden; overflow-y: auto; - float: left; + float: none; + flex-grow: 1; } div.sphinxsidebarwrapper > h3:first-child { @@ -202,9 +208,10 @@ div.sphinxsidebar input[type='text'] { font-size: 1.2em; cursor: pointer; padding-top: 1px; - float: right; + float: none; /* after Sphinx 4.x and earlier is dropped, only the below is needed */ width: 12px; + min-width: 12px; border-radius: 0 5px 5px 0; border-left: none; } @@ -485,7 +492,7 @@ div.genindex-jumpbox a { margin-inline-end: 0; } /* Remove sidebar and top related bar */ - div.related, .sphinxsidebar { + div.related, div.sphinxsidebar { display: none; } /* Anchorlinks are not hidden by fixed-positioned navbar when scrolled to */