diff --git a/_sass/_base.scss b/_sass/_base.scss index ea125e2..13a55d1 100644 --- a/_sass/_base.scss +++ b/_sass/_base.scss @@ -891,6 +891,18 @@ footer.sticky-bottom { // Rouge Color Customization figure.highlight { margin: 0 0 1rem; + + // Responsive code block container + overflow-x: auto; + -webkit-overflow-scrolling: touch; + + pre { + // Ensure code blocks can scroll horizontally + white-space: pre; + word-wrap: normal; + overflow-x: auto; + -webkit-overflow-scrolling: touch; + } } pre { @@ -899,6 +911,12 @@ pre { border-radius: 6px; padding: 6px 12px; + // Responsive behavior for code blocks + overflow-x: auto; + -webkit-overflow-scrolling: touch; + white-space: pre; + word-wrap: normal; + pre, code { background-color: transparent; @@ -913,6 +931,10 @@ code { background-color: var(--global-code-bg-color); border-radius: 3px; padding: 3px 3px; + + // Inline code should wrap + white-space: normal; + word-wrap: break-word; } // Transitioning Themes @@ -1092,6 +1114,62 @@ nav[data-toggle="toc"] { height: 0; top: 0; } + + /* Responsive code blocks for mobile */ + pre { + font-size: 0.875rem; + padding: 8px 10px; + margin: 0.5rem 0; + } + + figure.highlight { + margin: 0.5rem 0; + + pre { + font-size: 0.875rem; + padding: 8px 10px; + } + } + + code { + font-size: 0.875rem; + padding: 2px 4px; + } +} + +/* Extra small screens */ +@media (max-width: 400px) { + pre { + font-size: 0.8rem; + padding: 6px 8px; + } + + figure.highlight { + pre { + font-size: 0.8rem; + padding: 6px 8px; + } + } + + code { + font-size: 0.8rem; + padding: 1px 3px; + } +} + +/* Medium screens - optimize for tablets */ +@media (min-width: 577px) and (max-width: 768px) { + pre { + font-size: 0.9rem; + padding: 8px 12px; + } + + figure.highlight { + pre { + font-size: 0.9rem; + padding: 8px 12px; + } + } } .featured-posts {