You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/* @docs
label: Pre Wrapping
note: |
Overflow by default is bad...
category: typography
*/
pre { white-space: pre-wrap; }
I agree that "overflow by default is bad", but I'd argue that a better "fix" would be to prevent overflowing from happening rather than going against what this element is about:
The HTML <pre> element represents preformatted text which is to be presented exactly as written in the HTML file. The text is typically rendered using a non-proportional ("monospace") font. Whitespace inside this element is displayed as written.
As far as I can tell, pres we find in the wild are styled with overflow:auto as it prevents content from overflowing while preserving the formatting of that content. The example below shows that this is true for GitHub too:
---------------- A ---------------- B ---------------- C ---------------- D ---------------- E ---------------- F ---------------- G
^ ^ ^ ^ ^ ^ ^
So I'd suggest replacing white-space:pre-wrap with overflow:auto as it is more in line with how pre is styled IRL.
The text was updated successfully, but these errors were encountered:
The rule for
pre
is as follow:I agree that "overflow by default is bad", but I'd argue that a better "fix" would be to prevent overflowing from happening rather than going against what this element is about:
As far as I can tell,
pre
s we find in the wild are styled withoverflow:auto
as it prevents content from overflowing while preserving the formatting of that content. The example below shows that this is true for GitHub too:So I'd suggest replacing
white-space:pre-wrap
withoverflow:auto
as it is more in line with howpre
is styled IRL.The text was updated successfully, but these errors were encountered: