Skip to content

Instantly share code, notes, and snippets.

@b1nary
Created November 4, 2015 16:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save b1nary/bfa92344c54c2b71ffca to your computer and use it in GitHub Desktop.
Save b1nary/bfa92344c54c2b71ffca to your computer and use it in GitHub Desktop.
Collecting User Browser Display dimensions with CSS.
@media screen and (max-width: 1px){ #dummy { background:url(/endpoint/width/1); } }
@media screen and (max-width: 2px){ #dummy { background:url(/endpoint/width/2); } }
@media screen and (max-width: 3px){ #dummy { background:url(/endpoint/width/3); } }
@media screen and (max-width: 4px){ #dummy { background:url(/endpoint/width/4); } }
/* More */
@media screen and (max-width: 50px){ #dummy { background:url(/endpoint/width/50); } }
/* More */
@media screen and (max-width: 1280px){ #dummy { background:url(/endpoint/width/1280); } }
/* and then repeat same for height. Note that resizing the browser windows might creates additional requests */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment