Skip to content

Commit

Permalink
🐛 Add CSS overflow/wrapping on KaTeX, tables, and code sections
Browse files Browse the repository at this point in the history
This fixes a bug where long post elements could break out of the
width of the overall page and break overall formatting or views,
especially on mobile devices.
  • Loading branch information
ragibson committed Dec 18, 2023
1 parent 82b5481 commit 00ac16f
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
22 changes: 22 additions & 0 deletions assets/css/compiled/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -1231,6 +1231,28 @@ body:has(#menu-controller:checked) {
opacity: 0.05;
}

/* Fix long KaTeX equations on mobile (see https://katex.org/docs/issues.html#css-customization) */

.katex-display {
overflow: auto hidden
}

/* Fix long tables breaking out of article on mobile */

table {
display: block;
overflow: auto;
}

/* Fix long inline code sections breaking out of article on mobile */

code {
word-wrap: break-word;
/* All browsers since IE 5.5+ */
overflow-wrap: break-word;
/* Renamed property in CSS3 draft spec */
}

/* -- Chroma Highlight -- */

/* Background */
Expand Down
15 changes: 15 additions & 0 deletions assets/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,21 @@ body:has(#menu-controller:checked) {
@apply absolute -z-10 opacity-5;
}

/* Fix long KaTeX equations on mobile (see https://katex.org/docs/issues.html#css-customization) */
.katex-display { overflow: auto hidden }

/* Fix long tables breaking out of article on mobile */
table {
display: block;
overflow: auto;
}

/* Fix long inline code sections breaking out of article on mobile */
code {
word-wrap: break-word; /* All browsers since IE 5.5+ */
overflow-wrap: break-word; /* Renamed property in CSS3 draft spec */
}

/* -- Chroma Highlight -- */
/* Background */
.chroma {
Expand Down

0 comments on commit 00ac16f

Please sign in to comment.