How to deal with different screen resolutions in CSS?

前端 未结 5 692
礼貌的吻别
礼貌的吻别 2020-12-10 19:36

I am new to UI design- was wondering what the best way to deal with different screen resolutions is when positioning various HTML elements? I thought using %ages would be t

5条回答
  •  时光取名叫无心
    2020-12-10 19:59

    First see if this works for you. replace your tag with this

    Now if does, than implement this onload. This will reduce 100% of your headaches and will do a quick hack for laptops with 1366 x 768 screens without damaging the look and feel for newer, bigger and better screens

    var screenHeight = screen.height;
    if (screenHeight < 800) {
      $('body').css('zoom', 0.8);
    } else {
         $('body').css('zoom', 1);
    }
    

提交回复
热议问题