cssviewportwindows-rt

Setting viewport for Windows Surface RT via CSS


I'm making a Website for mobile devices, especially for Tablets. To set the viewport I'm using the meta Tag to controll the range of zooming:

<meta name="viewport" content="width=device-width, maximum-scale=1.8, minimum-scale=0.63"/>

Now I'm facing the problem, that IE10 on Windows surface ignores the Meta Tag, so I tried to set the viewport via CSS rules. Unfortunately the code I've tried is not working:

@-ms-viewport{
    minimum-scale: 0.63;
    maximum-scale: 1.8;
    min-zoom: 0.63;
    max-zoom: 1.8;
}
@viewport{
    minimum-scale: 0.63;
    maximum-scale: 1.8;
    min-zoom: 0.63;
    max-zoom: 1.8;
}

This is from my CSS file. I'm new to media query, so I don't know if the code is correct or if I'm just making some mistakes with the syntax or somthing else. I've also tried:

@media all{
@-ms-viewport{
    minimum-scale: 0.63;
    maximum-scale: 1.8;
    min-zoom: 0.63;
    max-zoom: 1.8;
}
@viewport{
    minimum-scale: 0.63;
    maximum-scale: 1.8;
    min-zoom: 0.63;
    max-zoom: 1.8;
}}

Doesn't work either. So has anyone a solution for controling the range of zooming for the Surface? Or does anyone see the mistakes I'm making?


Solution

  • We had a similar problem when testing our new reponsive site on a surface tablet which we resolved using the following tag

    @-ms-viewport { width: device-width; }
    

    However our initial and maximum scale are set to 1 and we're not trying to alter them.

    Looking at the MSDN docs for the @ms-viewport here http://msdn.microsoft.com/en-gb/library/ie/hh869615%28v=vs.85%29.aspx it doesn't appear to support the setting of scale and zoom using the viewport rule, so you may not be able to change this.

    These can only be set on the standard @viewport rule http://www.w3.org/TR/css-device-adapt/#the-viewport-rule according to the docs, no idea which browsers support them as yet.