-
Notifications
You must be signed in to change notification settings - Fork 163
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
Utility or class to add .5rem margin-top on images #4791
Comments
This one bugs me a lot and I don't know how to approach it. Creating a component for that purpose sounds weird. A utility/modifier on images may be a workaround, we have couple The issue I see is that this "top padding" is not really part of the image, it should be part of the rule component because it comes from it and it's a bit counterintuitive that instead of rule having bottom margin, we force some elements (only images?) after it to add top margin (that we don't use anywhere else). I experimented before with adding top margin to all images but this obviously causes some issues (especially when small images are used in lists, etc). |
The issue is this: All text elements and components (headings, tables, accordions, tabs, etc) comes with give or take .5rem of spacing already applied (the vertical rhythm nudges). Non text blocks of content (images, videos, etc) do not have that, so they sit a little higher up. So we need something to add that amount of space to those blocks of content, but not further displace text. To me that seems a clearcut case for having a class of some sort to do it. It can't be an element qualifier as that's too broad. |
@lyubomir-popov maybe a stupid question, but why do text elements have it built-in? Maybe we could remove it from text elements (move them up 0.5rem, so they will still be on the baseline) and then the rule component can simply have bottom margin? |
Its the nudges @bartaz
They are close to, but not precisely .5rem. So for those that are |
I understand that it's "next to no effort" to add a class name or a wrapper element to an image. The issue is that there is no nice way to implement it within a design system. It's not a good component, because it's only purpose is to nudge an image couple pixels down. So maybe it's a "variant" class name on an image. But will it only be images? You mentioned @lyubomir-popov other block components that may need that. Are there any examples? I guess I've seen cards under horizontal rule, anything else may go there? Would other components have such "nudge" built in, or would they need an option for it as well? |
applies to videos as well. not necessarily images only |
@lyubomir-popov to provide design guidelines for these spacing rules. Further discussion with @bartaz |
Scope: We could implement it as a new component called "media container", possibly as simple as: .p-media-container {
margin-top: $sp-unit;
} It should be documented on Images page https://vanillaframework.io/docs/patterns/images. <hr class="p-rule" />
<div class="p-media-container">
<img … />
</div> possibly should be mentioned on Rule component page, as it's mostly needed for situations when we place an image under a rule component (https://vanillaframework.io/docs/patterns/rule) |
We often need a space above the image (only the image) in layouts like these:
We have this locally in c.com, would be nice to have it documented and upstreamed to vanilla:
.p-image-wrapper { padding-top: $spv--small; }
The text was updated successfully, but these errors were encountered: