Search code examples
screen-resolution

Is it possible to scale a whole fixed-with page depending on the user's resolution?


Is it possible to make a page for 1600px900px with all measurements fixed as pixels and then adding code to scale everything down if the users width is too little?

I'm not asking for fluid CSS as I already made a fix-width page. I can't change all the measurements, but still need to find a way to scale the content down for smaller monitors.


Solution

  • This code did the trick.

    document.body.style.zoom = screen.width / 1600 + '';
    document.body.style.MozTransform = screen.width / 1600 + '';
    document.body.style.MozTransformOrigin = '0 0';
    document.body.style.OTransform =  screen.width / 1600 + '';
    document.body.style.OTransformOrigin = '0 0';
    document.body.style.WebkitTransform = screen.width / 1600 + '';
    document.body.style.WebkitTransformOrigin = '0 0';