Skip to content

Instantly share code, notes, and snippets.

View LeaVerou's full-sized avatar

Lea Verou LeaVerou

View GitHub Profile
@LeaVerou
LeaVerou / dabblet.css
Created March 15, 2023 14:43
Number of angles created by corner-shape
/**
* Number of angles created by corner-shape
*/
path {
fill: slategray;
}
text {
font: bold 100% Helvetica Neue;
@LeaVerou
LeaVerou / dabblet.css
Last active February 6, 2023 00:03
CSS Grid vs Lea: 1-0
/**
* CSS Grid vs Lea: 1-0
*/
.slide {
position: absolute;
inset: 0;
z-index: 1;
padding: 2.5rem;
box-sizing: border-box;
@LeaVerou
LeaVerou / dabblet.css
Created December 8, 2022 19:13
Untitled
body { background: red }
@container style(--foo: 1) {
body { background: green; }
}
html { --foo: 1 }
@LeaVerou
LeaVerou / go-to-spec.js
Created November 1, 2022 18:46
MDN Go to spec bookmarklet
javascript:{ let table = document.querySelector("#specifications + div > table.standard-table, #specifications + table.standard-table"); table.scrollIntoView({behavior: "smooth"}); table.querySelector("a")?.click(); } undefined;
@LeaVerou
LeaVerou / dabblet.css
Created August 10, 2022 14:59
meter gencontent
/**
* meter gencontent
*/
meter::before {
content: "before"
}
meter::after {
content: "after"
@LeaVerou
LeaVerou / dabblet.css
Created June 23, 2022 11:17
Never use circle size to convey information
/**
* Never use circle size to convey information
*/
div {
display: inline-flex; align-items: center; justify-content: center;
width: 200px;
aspect-ratio: 1 / 1;
padding: 1em;
background: radial-gradient(closest-side, hsl(220 10% 70%) calc(var(--p)), transparent 0) hsl(220 10% 90%);
@LeaVerou
LeaVerou / dabblet.css
Created June 9, 2022 12:13
Invalid custom property values
/**
* Invalid custom property values
*/
@property --foo {
syntax: "red | orange";
initial-value: red;
inherits: false;
}
html { --foo: green }
@LeaVerou
LeaVerou / dabblet.css
Created June 6, 2022 14:58
Division by <length> test
/**
* Division by <length> test
*/
div {
background: green;
width: 100px;
height: calc(100px * (100vw / 100vh));
}
@LeaVerou
LeaVerou / detect_custom_elements.js
Last active April 21, 2022 21:02 — forked from ebidel/highlight_custom_elements.js
Get a list of custom elements used on a page
// Highlights all custom elements on the page.
// 7/31/2016: updated to work with both shadow dom v0 and v1.
// To create a bookmarklet, use http://ted.mielczarek.org/code/mozilla/bookmarklet.html
var allCustomElements = [];
function isCustomElement(el) {
const isAttr = el.getAttribute('is');
// Check for <super-button> and <button is="super-button">.
return el.localName.includes('-') || isAttr && isAttr.includes('-');
@LeaVerou
LeaVerou / dabblet.css
Created February 28, 2022 18:16
Overriding presentational HTML
/**
* Overriding presentational HTML
*/
div {
background: pink;
}