Skip to content

Nested list styles are applied to inline-block elements inside list #47

@estevanmaito

Description

@estevanmaito

I've changed the default code style to the common approach of making it an inline-block and adding space around it. But inside lists I get this result:

image

This is the code to reproduce.

typography: {
  default: {
    css: {
      'h1 > a, h2 > a, h3 > a, h4 > a': {
        textDecoration: 'none',
      },
      code: {
        backgroundColor: defaultTheme.colors.gray[200],
        borderRadius: defaultTheme.borderRadius.default,
        paddingLeft: defaultTheme.spacing[1],
        paddingRight: defaultTheme.spacing[1],
        display: 'inline-block',
        lineHeight: defaultTheme.lineHeight['snug'],
      },
      'code::before': {
        content: 'none',
      },
      'code::after': {
        content: 'none',
      },
      'pre code::before': {
        content: 'none',
      },
      'pre code::after': {
        content: 'none',
      },
    },
  },
}

*Note that the last two rules are related to a bug in Firefox, fixed in #41

I think this is the cause https://github.com/tailwindlabs/tailwindcss-typography/blob/master/src/styles.js#L259

        '> ul > li > *:first-child': {
          marginTop: em(20, 16),
        },
        '> ul > li > *:last-child': {
          marginBottom: em(20, 16),
        },
        '> ol > li > *:first-child': {
          marginTop: em(20, 16),
        },
        '> ol > li > *:last-child': {
          marginBottom: em(20, 16),
        },

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions