RamseyInHouse / scut

Sass utilities for the frontend laborer.
https://ramseyinhouse.github.io/scut/
MIT License
769 stars 61 forks source link

Remove margins for first elems #170

Closed ldexterldesign closed 10 years ago

ldexterldesign commented 10 years ago

Hey,

This is a technique I use a lot: http://css-tricks.com/snippets/css/remove-margins-first-element/

Am I correct in thinking you use the following technique?: https://github.com/davidtheclark/scut/blob/master/dist/_scut.scss#L53

Sorry, only just started using @if statements in SASS; just trying to get my head around it

Cheers,

davidtheclark commented 10 years ago

Yes, I often do that -- but it's kind of different from the CSS Tricks one, so they are both important in different contexts.

My thought with the list-floated pattern is: If I only want margins between elements of the same type (that is <li> followed by <li>), then I can add margin-top to siblings.

In contrast, the pseudo-selectors first-child and last-child will not care whether they are adjacent to siblings of the same type.

You can also see in scut-reset the use of pseudo-selectors first-of-type and last-of-type, which serve a different purpose in different contexts: https://github.com/davidtheclark/scut/blob/v1.0.1/src/general/_reset.scss#L84

I'd say it's worth messing around on Codepen and seeing how different patterns will work in different situations.

Hope that helps.

However, I'm not sure how any of this relates to @if statements??

In the future, since this isn't really an issue, I'd ask it via email or StackOverflow. I'll close this issue for that reason but if you want to continue the conversation feel free to respond.