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

Add h- and v- margin/padding Shortcuts #3

Merged
merged 1 commit into from
Mar 21, 2013

Conversation

matthewwithanm
Copy link
Contributor

This adds four new mixins (h-margin, v-margin, h-padding, and v-padding) for setting only the values you want without duplicating them. This is preferable to using the CSS shorthand (which requires you to enter both the vertical and horizontal padding), and to separate -left and -right (or -top and -bottom) values, which requires you to duplicate the value.

This adds four new mixins (h-margin, v-margin, h-padding, and v-padding)
for setting only the values you want without duplicating them. This is
preferable to using the CSS shorthand (which requires you to enter both
the vertical and horizontal padding), and to separate -left and -right
(or -top and -bottom) values, which requires you to duplicate the value.
@aebsr
Copy link
Contributor

aebsr commented Mar 20, 2013

What do you think about offering an option that allows two values as well? so you could pass separate values for top vs the bottom. Similar to the .size() mixin seen here https://github.com/aebsr/bedrock/blob/master/mixins/declarations.less#L57

@matthewwithanm
Copy link
Contributor Author

I think that I'd prefer to just use the -left and -right properties for that. I don't really mind the duplication of the properties—just the values—and using the regular css properties is more clear than a mixin which the reader might have to look up. Your call, though.

aebsr pushed a commit that referenced this pull request Mar 21, 2013
Add h- and v- margin/padding Shortcuts
@aebsr aebsr merged commit 53f99b9 into hzdg:master Mar 21, 2013
@aebsr
Copy link
Contributor

aebsr commented Mar 21, 2013

If I'm extended a margin: 0, and want to later set it to margin: 1em 0 2em I'd have to still -top and -bottom. The purpose of your mixin is to remove the need to write 2 separate rules, so just allowing the mixin to optionally accept 2 vars only enhances that ability.

perhaps an edge case, but I've had to deal with situations like that kind of often. specially on nav and sidebar modules.

@matthewwithanm
Copy link
Contributor Author

Yeah, I understand. I was just saying that I don't mind using -top and -bottom—as long as the values are different. IMO the only time writing both properties is a problem is when you have to duplicate a value.

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

Successfully merging this pull request may close these issues.

2 participants