Skip to content

Instantly share code, notes, and snippets.

View jensgro's full-sized avatar

Jens Grochtdreis jensgro

View GitHub Profile
@jensgro
jensgro / index.html
Created June 15, 2023 13:56
Responsive Image with srcset
<h1>Responsive Images with srcset</h1>
<div class="wrapper">
<img class="flexible"
srcset="https://via.placeholder.com/320x160/ddd 320w,
https://via.placeholder.com/480x240/ccc 480w,
https://via.placeholder.com/768x384/444/fff 768w,
https://via.placeholder.com/1024x512/a20000/fff 1024w,
https://via.placeholder.com/1280x640/fd8700/000 1280w"
sizes="(max-width: 20em) 100vw,
<html>
<head>
<title>Click me if you can</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
html, body {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
@jensgro
jensgro / style.css
Created May 10, 2023 15:29 — forked from AlexWebLab/style.css
Retina displays CSS background image
.logo_background {
background-image: url('../img/logo@1x.png');
background-position: center center;
background-repeat: no-repeat;
background-size: 80px 40px; /* size of the logo image @ 1x */
}
@media /* only for retina displays */
only screen and (-webkit-min-device-pixel-ratio: 2),
only screen and (min--moz-device-pixel-ratio: 2),
only screen and (min-device-pixel-ratio: 2),
@jensgro
jensgro / input.scss
Created April 27, 2023 08:43
Generated by SassMeister.com.
// entnommen: https://github.com/jensgro/11ty-starter
// ======= Farben
$custom-colors: (
"black": (
"base": #000
),
"white": (
"base": #fff,
"nearly": #fafafa
),
@jensgro
jensgro / input.scss
Created April 26, 2023 13:52
Generated by SassMeister.com.
// entnommen: https://github.com/jensgro/11ty-starter
// ======= Farben
$custom-colors: (
"black": (
"base": #000
),
"white": (
"base": #fff,
"nearly": #fafafa
),
@jensgro
jensgro / input.scss
Created April 26, 2023 13:50
Generated by SassMeister.com.
// entnommen: https://github.com/jensgro/11ty-starter
// ======= Farben
$custom-colors: (
"black": (
"base": #000
),
"white": (
"base": #fff,
"nearly": #fafafa
),
@jensgro
jensgro / input.scss
Created April 26, 2023 13:46
Generated by SassMeister.com.
$fonts: (
Thin: 100,
ThinItalic: 100,
ExtraLight: 200,
ExtraLightItalic: 200,
Light: 300,
LightItalic: 300,
Regular: 400,
Italic: 400,
Medium: 500,
@jensgro
jensgro / .eleventy.js
Created March 21, 2023 21:17 — forked from sombriks/.eleventy.js
custom eleventy filter to count posts by year #eleventy #ssg
//...
eleventyConfig
.addFilter('yearTags', posts => {
const yearsList = posts.map(p => p.data.date.getFullYear())
const yearsCount = {}
yearsList.forEach(y => {
if (!yearsCount[y]) yearsCount[y] = 1
else yearsCount[y]++
});
return Object.keys(yearsCount)
/* version from https://kittygiraudel.com/snippets/sr-only-class/ */
.sr-only {
border: 0 !important;
clip: rect(1px, 1px, 1px, 1px) !important;
-webkit-clip-path: inset(50%) !important;
clip-path: inset(50%) !important;
height: 1px !important;
overflow: hidden !important;
margin: -1px !important;