How to Lock Window Size in HTML
When designing a Web page, it's possible to lock your browser window size using simple HTML code. This is useful if you do not want the user to scroll down on the page for aesthetic reasons—in this case all of the images and text in the page display at the same time within the browser window. Locking window size is also a way to limit the user's ability to view certain elements that might appear further down on the page.
Instructions
-
-
1
Try using "position:fixed" in your CSS (cascading style sheets) to lock the window size. First type "<style type="text/css">" in your "<head>" tags (if it's not already present). Enter "body {" on the next line, then "position:fixed;" after that, and finally close the code with a "}" sign. Type "</style>" to close out the style tag. In some browsers, like Internet Explorer you might also have to add "bottom:0;" on the next line after "position:fixed" to lock the window size. Leave all of the outer quotation marks you see here out when you're entering the code.
-
2
Use the "overflow:hidden" attribute in place of the "position:fixed" attribute as described in the first option as another alternative. The overflow attribute allows you to hide a portion of a page or element, creating the appearance of a locked window when you apply it to the entire body of the HTML document.
-
-
3
Add the attribute "scroll=no" (no outer quotation marks) to your body tag as another option to lock your window size. For instance, if you wanted a black background and no scrolling the final code would read "<body bgcolor=black scroll=no>", enter your text and images in the body section, then close the body with the "</body>" tag. This will prevent the user from scrolling through the body of your web page. Again, leave out the quotation marks you see here when writing the code.
-
1