-
Notifications
You must be signed in to change notification settings - Fork 288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow disabling of default margin spacing globally #52
Comments
Can you share a more concrete example hopefully with code/demo? I feel like the spacing is 90% of the work when styling this sort of content so if you don't need the spacing I'm curious if you're fighting an uphill battle even trying to use this at all 🤔 |
(I deleted my previous comment, as my problem was a typo. I am now able to override spacing as needed on each element.) My use-case for customizing all spacing is to implement consistent vertical rhythm by manually setting spacing. |
I think also that the spacing makes the plugin quite difficult to use. From my point of view, it would make more sense to apply the spacing only to the top of the next element. So the first element of the rich text does not have any additional top spacing. Example:
|
@adamwathan here's a concrete example: <div class="prose">
<div className="mt-10">
<div className="pt-4 pb-8">
<div className="text-lg text-blueGray-500">Next Article</div>
<h3 className="pb-2 mt-0 text-xl text-blueGray-600">
<Link href={`/essay/hello-world`}>
<a>Hello World</a>
</Link>
</h3>
</div>
<div className="mb-48 text-xl text-blueGray-600">
<Link href="/essays">
<a>← Back to Essays</a>
</Link>
</div>
</div>
</div> If I apply How do I use Here's the Tailwind Play → https://play.tailwindcss.com/ADYgiu697d |
I also find myself coming across a number of places where I'd love to use the other aspects provided by Tailwind Typography in contexts where the margin spacing is far too dramatic to be usable in context. As with @deadcoder0904 I wholly appreciate that this plugin seems to be made for body sections of blogs and similar, but the adjustments are pretty great -- I would only need to be able to either reduce or kill inter-element margins in order to use this. Ideally I would love for a reduced-margins variant (similar to the size variants) that allowed for use in cases where outside margins (above/below the global prose element) or large margins inside were somewhat reduced. I can currently do this by adjusting margins myself, but there are quite a few elements to adjust and it's quite difficult to do it whilst preserving a tasteful look. I also don't believe there's a way to compose reduced margins with sizes (since all of the margins are defined explicitly in terms of the em-size of the text). For now I've gone through and manually made a copy with all margins reduced, but an official variant with tasteful spacing would really help. :) |
I am facing the same issue whereby I want to remove margins for the header element. I managed to solve it by adding
Before <div class="prose max-w-none">
<h1 class="border-2 border-green-600">This is a h1 element</h1>
<h1 class="m-0 border-2 border-blue-600">This is a h1 element without margins</h1>
<h1 class="border-2 border-red-600">Another h1 below</h1>
</div>
After It is working well so far, but I am not sure if the |
You can avoid https://play.tailwindcss.com/Tzy1XftmV0 That's the best solution I could come up with to solve margin spacing modifications when using the typography packages. |
Going to close this as a non-goal of the project at the moment. You can add new modifiers yourself using the configuration API if you want to create classes like https://github.com/tailwindlabs/tailwindcss-typography#adding-new-modifiers If I ever end up needing that myself and building it I'll definitely consider including it by default but in the mean time I would recommend handling this in user-land. |
Element modifiers
This makes it easy to do things like style headings, paragraphs, links to match your brand, add a border radius to images, and more. |
Normally I write out custom solutions similar to Typography on projects for sections of content where I don't have direct access to the markup.
I figured I'd give Typography a try, but it's currently difficult to use because the plugin adds margin to elements within the prose class. This is particularly troublesome when working with preceeding components that have a consistent margin-bottom across the site, which would need to be adjusted to account for the additional margin added by Typography, or I would need to go through everything single element and add margin overrides in the config, which defaults the object of having a customisable solution off the shelf.
Being able to disable spacing, or use an override to apply margin only to the bottom or top of elements would help massively.
The text was updated successfully, but these errors were encountered: