Skip to content

Commit 52f6a45

Browse files
committed
attempting to make formulas horizontally scrollable
1 parent adb8165 commit 52f6a45

File tree

1 file changed

+59
-9
lines changed

1 file changed

+59
-9
lines changed

_layouts/default.html

Lines changed: 59 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
background-color: #fafafa;
1414
margin: 0;
1515
padding: 0;
16+
overflow-x: hidden; /* Prevent page-wide horizontal scrolling */
1617
}
1718

1819
main {
@@ -22,6 +23,7 @@
2223
background-color: white;
2324
border-radius: 8px;
2425
box-shadow: 0 2px 8px rgba(0,0,0,0.05);
26+
overflow-x: hidden; /* Prevent container horizontal scrolling */
2527
}
2628

2729
h1, h2, h3 {
@@ -68,25 +70,73 @@
6870
text-decoration: underline;
6971
}
7072

71-
/* ✅ Scrollable long equations */
72-
.math-display {
73+
/* ✅ Scrollable long equations - MathJax 3.x */
74+
/* Target MathJax display math containers (various formats) */
75+
.MathJax-Display,
76+
.MathJax_Display,
77+
div.MathJax_Display,
78+
mjx-container[jax="CHTML"][display="true"],
79+
mjx-container[display="true"] {
80+
display: block !important;
81+
width: 100% !important;
82+
max-width: 100% !important;
7383
overflow-x: auto !important;
74-
overflow-y: hidden;
75-
max-width: 100%;
76-
-webkit-overflow-scrolling: touch;
84+
overflow-y: hidden !important;
85+
margin: 1em 0 !important;
86+
box-sizing: border-box;
7787
}
7888

79-
.math-display > .MathJax {
80-
padding-bottom: 0.5rem;
89+
/* Ensure the MathJax content itself can scroll horizontally */
90+
/* Math content should maintain its natural width to allow scrolling */
91+
mjx-container[jax="CHTML"][display="true"] > mjx-math,
92+
mjx-container[display="true"] > mjx-math {
93+
display: inline-block;
8194
}
8295

83-
.math-display::-webkit-scrollbar {
96+
/* Style scrollbar for better UX on display equations */
97+
/* Webkit browsers (Chrome, Safari, Edge) */
98+
.MathJax-Display::-webkit-scrollbar,
99+
.MathJax_Display::-webkit-scrollbar,
100+
div.MathJax_Display::-webkit-scrollbar,
101+
mjx-container[jax="CHTML"][display="true"]::-webkit-scrollbar,
102+
mjx-container[display="true"]::-webkit-scrollbar {
84103
height: 8px;
85104
}
86-
.math-display::-webkit-scrollbar-thumb {
105+
106+
.MathJax-Display::-webkit-scrollbar-thumb,
107+
.MathJax_Display::-webkit-scrollbar-thumb,
108+
div.MathJax_Display::-webkit-scrollbar-thumb,
109+
mjx-container[jax="CHTML"][display="true"]::-webkit-scrollbar-thumb,
110+
mjx-container[display="true"]::-webkit-scrollbar-thumb {
87111
background: #ccc;
88112
border-radius: 4px;
89113
}
114+
115+
.MathJax-Display::-webkit-scrollbar-thumb:hover,
116+
.MathJax_Display::-webkit-scrollbar-thumb:hover,
117+
div.MathJax_Display::-webkit-scrollbar-thumb:hover,
118+
mjx-container[jax="CHTML"][display="true"]::-webkit-scrollbar-thumb:hover,
119+
mjx-container[display="true"]::-webkit-scrollbar-thumb:hover {
120+
background: #999;
121+
}
122+
123+
/* Firefox scrollbar styling */
124+
.MathJax-Display,
125+
.MathJax_Display,
126+
div.MathJax_Display,
127+
mjx-container[jax="CHTML"][display="true"],
128+
mjx-container[display="true"] {
129+
scrollbar-width: thin;
130+
scrollbar-color: #ccc transparent;
131+
}
132+
133+
/* Ensure inline math doesn't break layout */
134+
mjx-container:not([display="true"]) {
135+
display: inline-block;
136+
max-width: 100%;
137+
overflow-x: auto;
138+
vertical-align: middle;
139+
}
90140
</style>
91141
</head>
92142

0 commit comments

Comments
 (0)