Skip to content

Instantly share code, notes, and snippets.

@alphaolomi
Created July 31, 2019 14:33
Show Gist options
  • Save alphaolomi/fe1d2cf249ebdad1abc91f36253ec9d6 to your computer and use it in GitHub Desktop.
Save alphaolomi/fe1d2cf249ebdad1abc91f36253ec9d6 to your computer and use it in GitHub Desktop.

bits

Snippets of things I re-use but always forget exactly how to write it

HTML boilerplate

<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link rel="stylesheet" href="css/main.css">
</head>
<body>

    <script src="js/main.js" async defer></script>
</body>
</html>

HTML Video

<video controls poster="poster.jpg">
    <source type="video/webm" src="video.webm">
    <img src="poster.jpg" alt="">
</video>

HTML GIF as Video

<video autoplay loop muted playsinline poster="poster.jpg">
    <source type="video/webm" src="video.webm">
    <img src="original.gif" alt="">
</video>

HTML Picture Element

Serve different formats of the same image

<picture>
    <source type="image/webp" srcset="image.webp">
    <img src="image.jpg" alt="">
</picture>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment