Skip to content

Commit

Permalink
Limit height of code blocks (#3012)
Browse files Browse the repository at this point in the history
* Limit height of code blocks

Users often post lengthy code or configuration listings which makes following the actual discussion difficult. Therefore we limit a code block by half a screen while still being able to scroll through the code listing itself.

* Define a minimal code block height for small screens

* Add max-height compatibility for browsers that don't support `max()`

See https://caniuse.com/css-math-functions

* Less has a built-in `max` function, so we need to escape this value

Co-authored-by: David Wheatley <hi@davwheat.dev>
  • Loading branch information
pierres and davwheat authored Aug 11, 2021
1 parent 2dd9e17 commit f1ba5e7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions less/forum/Post.less
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@
border-radius: 0;
display: block;
overflow-x: auto;
// Backwards compatibility for browsers that don't support `max()`
max-height: 50vh;
max-height: ~"max(50vh, 250px)";
}
}
h1, h2, h3, h4, h5, h6 {
Expand Down

0 comments on commit f1ba5e7

Please sign in to comment.