Apply Breakpoint on Tailwind Typography theme section? #3060
-
I have a tailwind.config.jsconst fullBleed = {
width: '100%',
gridColumn: '1 / -1',
}
const halfBleed = {
...fullBleed,
width: '75%',
marginLeft: 'auto',
marginRight: 'auto',
}
module.exports = {
theme: {
extend: {
typography: (theme) => ({
DEFAULT: {
css: {
table: {
...halfBleed,
marginBottom: theme('spacing.16'),
fontSize: theme('fontSize.sm')[0],
lineHeight: theme('fontSize.sm')[1].lineHeight,
tableLayout: theme('tableLayout.fixed'),
},
},
},
md: {
css: {
table: {
width: '90%',
},
},
},
}),
},
variants: {},
plugins: [require('@tailwindcss/typography')],
},
} How do I achieve that? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey! Using the For example: <div class="prose">
<table>...</table>
</div> The table width will be <div class="prose prose-md">
<table>...</table>
</div> The table will be Instead of doing this, you want to use a media query in your typography: (theme) => ({
DEFAULT: {
css: {
table: {
...halfBleed,
background: 'red',
marginBottom: theme('spacing.16'),
fontSize: theme('fontSize.sm')[0],
lineHeight: theme('fontSize.sm')[1].lineHeight,
tableLayout: theme('tableLayout.fixed'),
+ '@media (min-width: 768px)': {
+ width: '90%'
+ },
},
},
},
}), You can probably interpolate Hope it helps 👍 |
Beta Was this translation helpful? Give feedback.
Hey!
Using the
md
key will not apply responsive styles, but rather apply different styles when using theprose-md
class.For example:
The table width will be
75%
, but...The table will be
90%
wide.Instead of doing this, you want to use a media query in your
DEFAULT.css.table
object to apply responsive styles by default: