Skip to content

Instantly share code, notes, and snippets.

@gregwhitworth
gregwhitworth / custom-props-set-property.js
Created February 28, 2017 01:34
custom-props-set-property.js
var myComponent = document.getElementsByClassName('my-component')[0];
myComponent.style.setProperty('--primary', 'green');
@gregwhitworth
gregwhitworth / custom-props-scoping.css
Created February 28, 2017 00:25
custom-props-scoping.css
body {
--primary: blue;
background: var(--primary);
}
.my-component {
--primary: yellow;
background: var(--primary);
}
@gregwhitworth
gregwhitworth / custom-props-animate.css
Created February 27, 2017 23:57
custom-props-animate.css
div {
--pos: 0;
left: var(--pos);
animation: move 1s;
}
@keyframes move {
to {
--pos: 50px;
}
@gregwhitworth
gregwhitworth / custom-props-feature-detection-2.css
Created February 27, 2017 23:30
custom-props-feature-detection-2.css
:root {
--foo: true;
}
body {
background: red;
}
@supports(--foo: false) {
body {
@gregwhitworth
gregwhitworth / custom-props-feature-detection.css
Last active March 17, 2017 17:32
custom-props-feature-detection.css
body {
background: red;
}
@supports(--foo: blue) {
body {
background: green;
}
}
div {
--primary: blue;
margin-top: var(--primary, 12px);
}
@gregwhitworth
gregwhitworth / creating-fallbacks.html
Created June 14, 2017 04:50
creating-fallbacks-for-IE
<!doctype html>
<html>
<head>
<title>Fallbacks!!!</title>
<style>
#test {
width: 100px;
height: 100px;
background: red;
}
.puzzle-game {
display: grid;
grid-area: game;
align-self: start;
justify-self: center;
max-width: 35vw;
border: 10px solid cornflowerblue;
grid: 1fr 1fr 1fr / 1fr 1fr 1fr;
background: rgba(0, 0, 0, .5);
}
@gregwhitworth
gregwhitworth / css-grid-example-of-longhands.css
Created October 24, 2017 16:35
css-grid-example-of-longhands
grid-template-rows: 1fr 1fr 1fr;
grid-template-columns: 1fr 1fr 1fr;
@gregwhitworth
gregwhitworth / index.html
Created December 7, 2017 04:47
Variable Fonts playground made with Mavo
<p>Variable Fonts</p>