• Importing Web Fonts with variable-exists()

    Sass has introspection functions that can check for available variables, mixins, functions, and features in our code.

    Read more
  • The Double Ampersand Mixin

    A while back, I wrote about a useful selector for applying margins to columns and buttons. The selector used a double ampersand with an adjacent sibling combinator (&+&).

    Read more
  • Making our Media Query Mixins More Flexible

    Media Queries are how we all make our sites responsive. Simple sites may only require a few but on large projects we find ourselves writing them dozens of times in order to wrangle in the content. Though relatively small, writing a query over and over can get tedious which is why most people choose to use a mixin to minimize the typing. There are a ton of mixins out there ranging from simple to complex. Many of them opted to name the breakpoints with the idea that the names would be more intuitive than a numeric em value. The mixin may look something like this:

    Read more
  • Getting Back To our @at-roots

    Nesting is a feature in Sass that allows you to write your CSS with the same visual hierarchy that we see in HTML. It can provide many organizational and time saving benefits but its misuse is one of the main criticisms of Sass and the CSS it outputs. There have been many articles espousing the three levels deep nesting rule. When observed, this rule can take care of the majority of nesting issues but there are still cases where pushing a nested selector up to the root would be useful. That is where the @at-root directive comes in.

    Read more
  • Nested @keyframes Rules

    A handy feature in Sass 3.3 was the @at-root directive, which outputs nested Sass rules at the root of the CSS.

    Read more
  • Viewport-Relative Headings with Sass

    Viewport-relative units (vw, vh, vmin, vmax) are a new set of dynamic CSS units for sizing elements. They’re called “viewport-relative” because they eliminate dependency on parent elements and allow sizing based on the viewport size. This makes them a handy unit for defining font sizes and building fluid layouts.

    Read more