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.

Unexpected CSS img styling

See original GitHub issue

This is in a similar vein to https://github.com/gatsbyjs/gatsby-starter-blog/issues/16 & as frustratingly tweeted https://twitter.com/kaihendry/status/778166191860936704 I don’t expect style to be set here.

What is the good reason RE https://twitter.com/kylemathews/status/778262611058053126 ?

I wasted a serious amount of time over this margin-bottom:1.66667rem. In hindsight the issue was staring at me from Chrome dev tools, but I really didn’t expect typography.js to setup so much CSS. I also resent it’s uglyfying my HTML’s header and not a separate file too.

I really don’t quite understand how a modern day dev is supposed to track cascading CSS rules and override & normalise things, since it seems like I can’t assume sane defaults anymore.

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:11
  • Comments:8

github_iconTop GitHub Comments

4reactions
aamistakcommented, Jul 8, 2020

This issue is coming up on Google so I wanted to post the solution:

When you intialize the Typography.js object you can provide overrideStyles

new Typography({
  overrideStyles: ({ rhythm }) => ({
    img: {
        marginBottom: 0
      }
  })
})

https://kyleamathews.github.io/typography.js/

4reactions
DamianPereiracommented, Jun 22, 2018

Is there any documentation on what typography.css styles apart from text elements? I’ve just checked and it seems to reset lots of element’s margin/padding to 0 except for margin-bottom which is set to 1.45rem. Elements like form, address and so are styled. What’s the reasoning for this? It seems arbitrary and breaks my layout.

I did not expect img styling at all, and I had to search for a while before I found where the margin-bottom was coming from (suspected font awesome CSS, or normalize, but not typography).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Styling Broken Images - bitsofcode
Broken images are ugly. This image is broken! Ugly, isn't it? But they don't always have to be. We can use CSS to...
Read more >
Unexpected css behaviors - html - Stack Overflow
I think my other problem has to do with the inline-block property. I would like the main content list id="auction_list" to fill up...
Read more >
How To Style Figure and Image HTML Elements with CSS
This tutorial will lead you through examples of image CSS styling for web pages, allowing you to make informed decisions about how images ......
Read more >
Handling Long and Unexpected Content in CSS
To make it more robust, we should float the author image and add overflow: hidden to the author name wrapper. That way, we...
Read more >
Picture perfect images with the modern <img> element
This isn't a huge surprise as we humans are quite visual and the <img> tag has ... Set dimensions (width, height) on your...
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