Viewport meta tag for desktop browsers?

前端 未结 5 654
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-31 07:32

My client is asking me to reduce size of current website for desktop browsers by 30%.

is there a css or meta tag to do it like viewport meta tag on a mobile browser?

5条回答
  •  迷失自我
    2020-12-31 08:08

    Here code for proportional scale and positioning, wnen using "transform: scale"

    CSS

    html,body
    {
        width: 100%;
        height: 100%;
        margin:0;
        padding:0;    
    }
    html
    {
        position:absolute;
    }
    

    JS

    var scale = 1;
    $('html').css('transform','scale('+scale+')');
    
    var windowWidth = $(window).width();
    $('body').append(windowWidth);
    $('body').append(' ' + windowWidth*scale );
    //$('html').width(windowWidth*scale);
    
    
    var width = (100*(1/scale));
    var left = -(width*(1-scale))/2;
    
    var height = (100*(1/scale));
    var top = -(height*(1-scale))/2;
    
    $('html').css('top', top+'%');
    $('html').css('left', left+'%');
    $('html').width(width+'%');
    $('html').height(height+'%');
    

提交回复
热议问题