Using breakpoints with bourbon and neat with media () mixin

I set 3 different breakpoints using bourbon and carefully. I followed some of the information in the race to set up a variable for use in the media mix. This makes it ridiculously easy to throw at breakpoints.

@include media($small-screen-up) {
.foo {property; value;}
}

Historically, I set breakpoints and basically contained all the relevant styles at breakpoints.

@media screen and (min-width: 40em) and (max-width: 53.75em) {
// all my medium screen rulesets here, yay!
  .foo {
    property: value;
   }
}

@media screen and (min-width: 53.76em) and (max-width: 80em) {
// all my large screen rulesets here, yay!
  .foo {
    property: value;
   }
}

With this mixin and variables configured for breakpoints, I found myself approaching it differently.

.foo {
  property: value;

    @include media($medium-screen-up) {
   property: value;
   }

   @include media($large-screen-up) {
   property: value;
   }
}

So, you can see that I work in one set of rules and adjust the styles in the set of rules depending on the size of the target screen.

It seems right, but it also feels dirty.

, , , . .

, @media . CSS.

? "" ? ( ). bourbon, () ?

+4

All Articles