Skip to content
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

Adjusting margins for arbitrary borders and padding #20

Open
mmadden opened this issue Sep 24, 2014 · 11 comments
Open

Adjusting margins for arbitrary borders and padding #20

mmadden opened this issue Sep 24, 2014 · 11 comments

Comments

@mmadden
Copy link

mmadden commented Sep 24, 2014

I'm really enjoying Sassline so far, especially the breakpoint-specific scales, etc. However, I'm having some difficulty styling a simple <button> that maintains the vertical rhythm and it seems this will be a problem for other elements requiring borders or more padding.

The sassline mixin doesn't seem to have a way to account for additional padding or borders. For example, in the case of a <button> a 1px border causes the inner text to fall 1px below the baseline, and all descendant elements to fall 2px below the baseline. Also padding-top is always greater than padding-bottom which isn't typically desirable in buttons or other form input elements where the text should be vertically centered between the borders.

Please let me know if I'm missing something, but it seems like another mixin or function is needed that also accepts border and/or padding arguments and automatically adjusts the top/bottom margins to maintain the vertical rhythm by snapping to the closest fitting n lines of the current baseline.

When this is a solved use case (or if it is already), perhaps we can update the Sassline demo to include basic form elements.

Keep up the great work Jake!

@mmadden mmadden changed the title Top/bottom margins that compensate for arbitrary borders and padding Adjusting margins for arbitrary borders and padding Sep 24, 2014
@jakegiltsoff
Copy link
Owner

Hi Matthew, I’ll look into getting something sorted for form elements. Thanks!

@pjhawksr
Copy link

+1

@bobcolner
Copy link

This would be a great feature for many use cases. +1.

@lukakemperle
Copy link

+1

1 similar comment
@wachilt
Copy link

wachilt commented May 10, 2015

+1

@jakegiltsoff
Copy link
Owner

A workaround for now that can easily be used is to apply the baseline mixin to a containing element.

For example wrap a button in a div with class .button-align, then use

.button-align { @include baseline(zeta, $bodytype, 2, 2, all); }

screen shot 2015-05-31 at 22 32 57

When I have time I will look into a mixin that can control additional vertical padding/borders and add some examples to the demo.

@wachilt
Copy link

wachilt commented May 31, 2015

Thanks Jake, very much appreciated.

@OliverM
Copy link

OliverM commented Feb 12, 2016

This is especially ironic given that the button captions on sassline.com are off the baseline...! Thanks for the workaround details.

@jakegiltsoff
Copy link
Owner

@OliverM It made more sense to me to have the buttons themselves fit to the baseline there.

@pjhawksr
Copy link

@jakegiltsoff Thanks!

@OliverM
Copy link

OliverM commented Feb 12, 2016

Yeah, there's no non-button text on either side so it makes sense that the visual rhythm would match the button borders. By way of background, I'm designing forms with 20+ input fields of various types, each with text labels, so the workaround above is great to have.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants