Skip to content

Commit 6cee3f7

Browse files
committed
fix code block scrolling
1 parent 16f6be1 commit 6cee3f7

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

.vitepress/theme/styles.scss

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -424,8 +424,8 @@ footer {
424424

425425
/* expand width on big screens */
426426
@media screen and (min-width: 1600px) {
427-
div[class*='language-']:hover,
428-
div[class*='language-']:focus,
427+
div[class*='language-']:not(.vp-code-group div[class*='language-']):hover,
428+
div[class*='language-']:not(.vp-code-group div[class*='language-']):focus,
429429
pre.log:hover,
430430
pre.log:focus {
431431
min-width: fit-content;
@@ -439,7 +439,7 @@ footer {
439439
tr {
440440
z-index: 1; position: relative; // draw wide rows over outline
441441
}
442-
[class*='language-'] pre {
442+
[class*='language-']:not(.vp-code-group [class*='language-']) pre {
443443
overflow: hidden !important;
444444
}
445445
// expand navbar to cover wide content (see java/development/properties)
@@ -461,6 +461,19 @@ footer {
461461
}
462462
}
463463

464+
/* Hide scrollbars by default, show on hover */
465+
[class*='language-'] pre,
466+
pre.log {
467+
scrollbar-width: none;
468+
&::-webkit-scrollbar { display: none; }
469+
}
470+
471+
[class*='language-']:hover pre,
472+
pre.log:hover {
473+
scrollbar-width: thin;
474+
&::-webkit-scrollbar { display: block; }
475+
}
476+
464477
@media print {
465478
.VPNav, .VPSidebar, .VPDocAside, .VPDocFooter {
466479
display: none !important;

0 commit comments

Comments
 (0)