How to adapt website to user screen resolution?

I am developing my site using a 1024x768 screen resolution base. When you look at a website in a browser from a computer with a lower / higher screen resolution, the website starts to warp. How can I adapt a website to the user's screen resolution regardless of the user's screen resolution? I believe this is possible via JavaScript or CSS, but I don’t know how ...

+3
source share
2 answers

The best way to solve this problem is to use em or% (in percent) instead of using px.

.container {
  width: 1000 px;
  height: 750 px;
}

.container {
  width: 90%;
  height: 90%'
}
+4
source

What you are looking for is a browser viewer.

, : http://andylangton.co.uk/articles/javascript/get-viewport-size-javascript/

window.innerWidth window.innerHeight JavaScript.

dojo JavaScript, dijit.getViewport(), .

, , - , .

0

Source: https://habr.com/ru/post/1787386/


All Articles