Skip to content

Instantly share code, notes, and snippets.

@flexchar
Created June 7, 2019 11:57
Show Gist options
  • Save flexchar/0656eca2bf8231529479f2d03f5d77ba to your computer and use it in GitHub Desktop.
Save flexchar/0656eca2bf8231529479f2d03f5d77ba to your computer and use it in GitHub Desktop.
Example of WebP not working inside <picture> tag
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>WebP Test</title>
<style>
body {
display: flex;
height: 100vh;
margin: 0;
justify-content: center;
align-items: center;
}
picture {
width: 50%;
}
picture > * {
max-width: 100%;
}
</style>
</head>
<body>
<picture>
<source type="image/webp" srcset="https://i.ytimg.com/vi_webp/2bVik34nWws/maxresdefault.webp">
<source type="image/jpeg" srcset="https://i.ytimg.com/vi_webp/2bVik34nWws/maxresdefault.jpg">
<img src="https://i.ytimg.com/vi_webp/2bVik34nWws/maxresdefault.jpg">
</picture>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment