Tagged “code”
Use Eleventy templating to include static code demos
Here’s a great tutorial from Eleventy guru Stephanie Eckles in which she explains how to create a page that displays multiple code demos, similar to SmolCSS.dev.
It’s interesting that Stephanie uses 11ty shortcodes over other 11ty templating options and that she sometimes declares a variable (via Nunjucks’s set
) at the top of the page then intentionally reuses it unchanged in repeated shortcode instances… the example being times where you want to illustrate the same HTML code (variable) being styled differently in progressive demos.
I also like the Open in CodePen feature and section on scoped styling.
Carbon
Create and share beautiful images of your source code. Start typing or drop a file into the text area to get started.
I’ve noticed Andy Bell using a really lovely format when sharing code snippets on Twitter. Turns out that it was using this great tool.
(via @hankchizljaw)
Box Shadow around the full box
Sometimes when coding a UI element you want a shadow around the whole box. However, most CSS box-shadow examples/tutorials tend to show inset box-shadows or ones that otherwise sit off to the side.
Here’s how to apply box-shadow
to the whole box for a simple but nice effect.
.box-with-shadow {
box-shadow: 0 0 4px #ccc;
}
And here’s how it looks:
See all tags.