How to limit the minimum screen size?

Asked

Viewed 1,828 times

2

I’m working with Bootstrap.

What I want is for the user to be able to decrease the screen up to 700px and from the moment he has with 700px the screen does not decrease more.

It can be via Jquery, Javascript, in JAVA itself or just by CSS, any way help.

Thank you.

  • body { min-width: 700px; } must solve.

  • Citing this property in the Code does not prevent the user from decreasing the screen, it only says that the minimum size when loading will be 700px. Thank you

  • If you are talking to the browser window, fortunately this is beyond reach ;D

  • The ideal would be to use media queries, and define what properties and values you want for each size or from a certain screen size. http://www.w3schools.com/cssref/css3_pr_mediaquery.asp I hope I helped you.

1 answer

1

If you want to limit the size of the browser window, you can’t. You could only do that if you opened the window with window.open(), doing something like that:

window.addEventListener('resize', function() {
    if(window.outerWidth < 700) {
        window.resizeTo(700, window.outerHeight);
    }
}, true);

Now, if you want to limit the page body size, do it with CSS:

body {
  min-width: 700px;
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.