Skip to content

Instantly share code, notes, and snippets.

@CarterTsai
Created November 30, 2019 14:18
Show Gist options
  • Save CarterTsai/69b1648d942e7b97767ccf3600c05dd8 to your computer and use it in GitHub Desktop.
Save CarterTsai/69b1648d942e7b97767ccf3600c05dd8 to your computer and use it in GitHub Desktop.
image RWD with picture
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Image Test</title>
</head>
<style>
.box {
width: 100%;
text-align: center;
}
</style>
<body>
<div class="box">
<h1>Image Reize with Picture Tag</h1>
<picture>
<source srcset="/image/test/320x480"
media="(min-width: 600px) and (max-width: 720px)">
<source srcset="/image/test/480x720"
media="(min-width: 720px)">
<img src="/image/test/300x250" />
</picture>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment