A demo of window.matchMedia, currently implemented in Firefox, Google Chrome and Safari. Resize the window to vet value for different matches.

window.matchMedia is not supported

window.matchMedia for 600 pixels width:

window.matchMedia for 500 pixels height:

window.matchMedia for portrait orientation: