Skip to content

Improve Code Rendering#651

Open
irfanfadilah wants to merge 3 commits intopicocss:mainfrom
irfanfadilah:improve-code-rendering
Open

Improve Code Rendering#651
irfanfadilah wants to merge 3 commits intopicocss:mainfrom
irfanfadilah:improve-code-rendering

Conversation

@irfanfadilah
Copy link
Copy Markdown

This PR improves the style for block and inline <code> tags.

Fix Overflow

Commit: 397853f

Move the overflow-x: auto; property from pre to code to fix scrolling and padding.

Before After
pre-code-before pre-code-after

Improve Inline Spacing

Commit: 2e89229

The inline <code> tags touch each other when stacked in multiple lines, so I adjusted the vertical padding to 0.125rem. I also added vertical-align: middle; to improve the text alignment.

Before After
inline-code-before inline-code-after

@Yohn
Copy link
Copy Markdown

Yohn commented Jan 14, 2025

Hey @irfanfadilah
I've been keeping up with some pull requests and changes in a forked branch of at Yohn/PicoCSS and I'd love to have this added to there if you'd like to create a pull request!

feeela added a commit to feeela/picocss that referenced this pull request Feb 3, 2026
Amaury added a commit to Digicreon/muCSS that referenced this pull request Mar 22, 2026
@Amaury
Copy link
Copy Markdown

Amaury commented Mar 22, 2026

We partially applied this PR in µCSS (our PicoCSS-based framework).

We only took the inline padding fix (padding: 0.125rem 0.375rem on code, kbd, samp), which is a clear improvement for inline code elements stacking across multiple lines.

We did not apply:

  • The overflow-x: auto relocation from pre to code — this is a more structural change to block code rendering, and we'd want to see it merged upstream first before overriding PicoCSS behavior at that level.
  • vertical-align: middle — we didn't observe a noticeable alignment issue in our testing, and adding it could interfere with surrounding inline elements in some contexts.

Thanks for the PR — the inline padding part is a definite improvement!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants