Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Idea for CSS-only responsive images using CSS3 generated content and attr() function. No browser implementation as of May 2011
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS responsive images</title>
/* Doesn't stop original source image being
downloaded too */
@media (min-device-width:600px) {
img[data-src-600px] {
content: attr(data-src-600px, url);
@media (min-device-width:800px) {
img[data-src-800px] {
content: attr(data-src-800px, url);
<img src="image.jpg"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.