-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathcodeblock.css
78 lines (70 loc) · 2.42 KB
/
codeblock.css
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/* Base styles for code blocks */
.rounded.language-yml.theme-code-block,
.rounded.language-yaml.theme-code-block {
min-width: 100%;
width: max-content;
max-width: min(calc(100dvw - 32px), 1000px); /* Reduced side padding for mobile */
z-index: 99;
position: relative;
overflow-x: auto; /* Always allow horizontal scroll */
-webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}
/* Style for the code content */
.rounded.language-yml.theme-code-block .prism-code,
.rounded.language-yaml.theme-code-block .prism-code {
max-width: 100%;
overflow-x: auto;
scrollbar-width: thin; /* Firefox */
scrollbar-color: rgba(155, 155, 155, 0.5) transparent; /* Firefox */
}
/* Webkit scrollbar styling */
.rounded.language-yml.theme-code-block .prism-code::-webkit-scrollbar,
.rounded.language-yaml.theme-code-block .prism-code::-webkit-scrollbar {
height: 6px;
width: 6px;
}
.rounded.language-yml.theme-code-block .prism-code::-webkit-scrollbar-track,
.rounded.language-yaml.theme-code-block .prism-code::-webkit-scrollbar-track {
background: transparent;
}
.rounded.language-yml.theme-code-block .prism-code::-webkit-scrollbar-thumb,
.rounded.language-yaml.theme-code-block .prism-code::-webkit-scrollbar-thumb {
background: rgba(155, 155, 155, 0.5);
border-radius: 3px;
}
/* Fade effect for overflow */
.rounded.language-yml.theme-code-block .prism-code:after,
.rounded.language-yaml.theme-code-block .prism-code:after {
content: '';
position: absolute;
right: 0;
top: 0;
bottom: 0;
width: 40px;
background: linear-gradient(to right, transparent, var(--code-bg, #1a1a1a));
opacity: 0.75;
pointer-events: none;
}
/* Media query for mobile devices */
@media (max-width: 768px) {
.rounded.language-yml.theme-code-block,
.rounded.language-yaml.theme-code-block {
font-size: 14px; /* Smaller font size for mobile */
line-height: 1.4;
padding: 12px;
max-width: calc(100dvw - 24px);
}
.rounded.language-yml.theme-code-block .prism-code:after,
.rounded.language-yaml.theme-code-block .prism-code:after {
width: 24px; /* Smaller fade effect on mobile */
}
}
/* Media query for very small screens */
@media (max-width: 380px) {
.rounded.language-yml.theme-code-block,
.rounded.language-yaml.theme-code-block {
font-size: 12px;
padding: 8px;
max-width: calc(100dvw - 16px);
}
}