Skip to content

Instantly share code, notes, and snippets.

// Custom properties to Sass fallback
// @params {String}: $customProp, $renderedValue
// Sass Variables
$color-base: #000000;
$color-base-darkest: #0b0b0b;
$color-base-darker: lighten($color-base, 20);
$color-base-dark: lighten($color-base, 40);
$color-base-light: lighten($color-base, 60);
$color-base-lighter: lighten($color-base, 80);
@roroland
roroland / Smooth scroll css only
Last active May 25, 2020 15:37
Smooth Scroll (css) #css #scss
html {
scroll-behavior: smooth;
}
@media screen and (prefers-reduced-motion: reduce) {
html {
scroll-behavior: auto;
}
}
@roroland
roroland / reset
Created November 26, 2018 14:37
Simple reset
html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
@roroland
roroland / Visual Studio
Created June 27, 2018 12:27
Indent specific block Visual Studio #visual #ide
Ctrl+k , Ctrl+f
@roroland
roroland / Extend
Created April 13, 2018 10:55
Extend #scss
%animal {
background: gray;
// and so on...
}
.cat {
@extend %animal;
color: white;
}
.dog {
@extend %animal;
@roroland
roroland / Content block argument for mixins
Created April 13, 2018 10:34
Content block argument for mixins #scss
@mixin only-for-mobile {
@media (max-width: 768px) {
@content;
}
}
@include only-for-mobile() /* note: @content begins here */ {
p {
font-size: 150%;
}
@roroland
roroland / expand var
Last active April 13, 2018 10:23
Variable expansion in selectors #scss #css
$alertClass: "error";
p.message-#{$alertClass} {
color: red;
}
$breakpoint: 768px;
@media (max-width: #{$breakpoint}) {
/* This block only applies to viewports <= #{$breakpoint} wide... */