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.

  • 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.

  • 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.

  • 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.

Related Searches


Promoted By Zergnet


You May Also Like

  • Can You Lock Internet Browser Settings?

    Restricting access to Internet browser settings is a common practice of libraries, museums and business to protect themselves from online security threats....

  • How to Measure Window Sizes

    Windows come in many different sizes. Depending upon the age of your home, they may all be the same size, or every...

  • How to Adjust Browser Font Size

    All well-designed websites incorporates the text size defined in your browser. You can set the text to any size that is most...

  • How to Resize a Window in HTML

    Web page designers use a general, universal computer mark-up language called (HTML). Designers can define many different elements of a web page...

  • How to Fix Computer Screen Size

    Computer screens are built to operate at several different screen resolutions. If your computer is set to a screen resolution that is...

  • How to Fix Browser Window Size

    Whether your use Internet Explorer or an alternate browser like Mozilla Firefox or Google Chrome, having the ability to change the size...

  • How to Increase Text Size in HTML

    HyperText Markup Language, or HTML, is a markup language used to develop Web pages. Every Internet site contains HTML in one form...

  • International Building Codes on Window Header Sizes

    Without headers of the proper size, your walls could fall in. Window headers support the roof and other structure above a window;...

Related Searches

Check It Out

Geek Vs Geek: Robot battles, hoverboard drag race, and more

Is DIY in your DNA? Become part of our maker community.
Submit Your Work!