question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[CSSReset] HTML headings don't work as expected

See original GitHub issue

I noticed an issue when using react-markdown which uses html tags for rendering markdown.

Apparently, the CSSReset sets font-size and font-weight for h1-h6 to inherit

https://github.com/chakra-ui/chakra-ui/blob/5f15805914ea3c4fc0338228a8a95f657f408bbe/packages/chakra-ui/src/CSSReset/preflight.js#L489-L496

This causes HTML headings to not have the look that one would expect as seen in this sandbox.

https://codesandbox.io/s/rough-violet-84oif

However, if I remove the styling via devtools, they look fine.

Screenshot 2019-09-20 at 17 42 45

It also seems that the CSSReset is doing other things as well that affect the look and feel of the site, which would probably fit better inside the default theme, while leaving the actual resets like body margins and such inside the reset.

For example:

https://github.com/chakra-ui/chakra-ui/blob/5f15805914ea3c4fc0338228a8a95f657f408bbe/packages/chakra-ui/src/CSSReset/preflight.js#L440-L443

https://github.com/chakra-ui/chakra-ui/blob/5f15805914ea3c4fc0338228a8a95f657f408bbe/packages/chakra-ui/src/CSSReset/preflight.js#L403-L404

Another thing that I noticed is that without the CSSReset, some styling breaks, such as this <Textarea> extending over a <Flex>. This might be related to something else though but I managed to fix it with <Textarea width="initial">

Screenshot 2019-09-20 at 18 02 42

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

8reactions
subodhk01commented, Jun 21, 2021

Has anyone found the solution for this issue?

5reactions
VR314commented, Jul 12, 2021

@subodhk01, this is the solution I found: chakra-ui-markdown-renderer.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CSS counter-reset does not work inside pseudo elements
The following CSS counter example does not work as expected. The counter for sub-headings should reset after every main heading:.
Read more >
Reboot, Resets, and Reasoning - CSS-Tricks
Reboot builds upon Normalize, providing many HTML elements with somewhat opinionated styles using only element selectors. Additional styling is ...
Read more >
CSS Tip #1: Resetting Your Styles with CSS Reset - WebFX
Reset CSS is the process of resetting the styles of all elements to a baseline value to avoid cross-browser differences. Learn more here!...
Read more >
My Custom CSS Reset - Josh W Comeau
Historically, the main goal of a CSS reset has been to ensure consistency between browsers, and to undo all default styles, creating a...
Read more >
Why “Reset” Style Sheets Are Bad - Jens Oliver Meiert
First, resets often just get overwritten, meaning that people have this body { line-height: 1; } rule in their imported reset style sheet...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found