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.

next/image having specificity issues with Tailwind Typography

See original GitHub issue

Bug report

Describe the bug

When using Tailwind Typography and the prose element, it automatically adds margin-top and bottom to the img element. This messes up the responsive-ness of the next/image component.

To Reproduce

I’ve set a width and height image

But it’s displayed wrong image

Toggling these styles fixes it. image

Expected behavior

I’d be great if we can build this into next/image to prevent users from hitting issues with Tailwind Typography.

Screenshots

See repo.

System information

  • OS: Mac
  • Browser: Chrome
  • Version of Next.js: 10.0.3
  • Deployment: next start and Vercel

Issue Analytics

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

github_iconTop GitHub Comments

3reactions
erhankaradenizcommented, Dec 9, 2020

Hi Lee, since tailwind 2.0 and the update on the typography plugin you are able to update styles that are applied via prose through your tailwind.config.js. I can imagine it being something like this:

// tailwind.config.js
module.exports = {
  theme: {
    extend: {
      typography: {
        DEFAULT: {
          css: {
            img: {
              marginTop: 0,
              marginBottom: 0
            },
          },
        },
      }
    },
  },
  plugins: [
    require('@tailwindcss/typography'),
  ],
}

But still it would be nice for people who don’t know about this feature that next/image fixes it.

0reactions
balazsorban44commented, Jan 29, 2022

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Switching to Tailwind CSS - Lee Robinson
Learn why I switched my Next.js blog to use Tailwind CSS and how it impacted performance.
Read more >
Building a Blog With Next Js with Markdown and Tailwind CSS
Create a basic blog using Next.js and Markdown.Code: https://github.com/theindianappguy/next-blog-markdownDemo: ...
Read more >
Basic Features: Font Optimization - Next.js
Optimizing loading web fonts with the built-in `@next/font` loaders. ... To use the font on a single page, add it to the specific...
Read more >
How to use Tailwind CSS with Next.js Image - Stack Overflow
I want to use Tailwind classes instead of the height and width property of the Next.js Image. But I can't because it throws...
Read more >
@tailwindcss/typography - Tailwind CSS
Advanced topics. ​. Undoing typography styles. If you have a block of markup embedded in some content that shouldn ...
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