HTML: How to Create a Non-Scrolling Region in HTML


Previous Topic Previous Next Topic Next
Xoc Software
Training
RVBA Conventions
Maya Calendar Program
Company Information
Tools
ASP.NET and Other Tips
.NET: Debugging Designer Features of a Custom Control in Visual Studio
.NET: Setting the Default Font in a Windows Mobile/Compact Framework Custom Control
.NET Fixing C# XML Comments so they Work in Windows XP SP2
.NET: Getting and Setting the Application Version Number
.NET: Getting the Path of the Executing Assembly
.NET: Retrieving Assembly Attributes
.NET: Setting the RootFolder to Other Values in the FolderBrowserDialog in .NET
.NET: Sizing Columns in a ListView Control in .NET
.NET: Using Remoting in .NET
ASP.NET: Constructing a Graphic on the Fly in ASP.NET
ASP.NET: Controlling Caching in ASP.NET Web Forms
ASP.NET: How to use the FrontPage Server Extensions with ASP.NET
ASP.NET: Seeing What is in the ViewState in ASP.NET Web Forms
ASP.NET: Using Forms Authentication in ASP.NET
ASP.NET: View Trace Information on your ASP.NET Web Pages
ASP: Create XML from an ADO query
ASP: Detect Incomplete Loads
ASP: Including an ASP.NET Web Page In a Classic ASP Web Page
ASP: Process .HTM Files with Scripts and Server Side Includes
ASP: QuickSort Algorithm
ASP: Retrieve all server variables from IIS
ASP: Send Email from Active Server Page
HTML: How to Create a Non-Scrolling Region in HTML
IE: Allowing Only Certain ActiveX Controls to Run in Internet Explorer
IIS: Creating a web site for testing in IIS Server
IIS: Creating Multiple Web Sites within IIS on Windows 2000 and Windows XP Professional
IIS: IIS/Visual InterDev Problems and Fixes
IIS: Redirect a domain such as xoc.net to www.xoc.net
SQL Server: Execute SQL Server Updategram
Web Design: Design for People with Disabilities
Web Design: Keep a Web Page out of the Google Cache
Windows: Get HTTP Header of a Web Page using Telnet
Windows: Testing Domain Names without DNS
Windows: Using Hosts File to Access Web Sites with XP SP2
Windows: Windows XP Command Line Tools
Windows Mobile: Reprogramming the Push-to-Talk Button on the AT&T Tilt
Articles
Miscellaneous
Downloads
Links
Search
Email

Other Xoc managed sites:
http://grr.xoc.net
http://www.986faq.com
http://www.mayainfo.org
https://mayacalendar.xoc.net
http://www.yachtslog.com

To create a non scrolling region (without using frames) on a page, you can do it in one of two ways. The first way requires that you do a little trick with some javascript.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
   <head>
      <title>Non-Scrolling Region Example</title>
      <script language="javascript">
         function Setup()
         {
            window.onresize=ResizeScrolling;
            ResizeScrolling();
         }
         
         function ResizeScrolling()
         {
            scrolling.style.height = document.body.offsetHeight 
            - nonscrolling.offsetHeight - 4
         }
      </script>
   </head>
   <body scroll="no" onload="Setup()" style="margin:0">
      <div id="nonscrolling" style="background-color:silver">
         This is the non-scrolling region<br>
         This part won't scroll
      </div>
      <div id="scrolling" style="overflow=auto">
         This is the scrolling region<br>
         This is the scrolling region<br>
         This is the scrolling region<br>
         This is the scrolling region<br>
         This is the scrolling region<br>
         This is the scrolling region<br>
         This is the scrolling region<br>
         This is the scrolling region<br>
         This is the scrolling region<br>
         This is the scrolling region<br>
         This is the scrolling region<br>
         This is the scrolling region<br>
         This is the scrolling region<br>
         This is the scrolling region<br>
         This is the scrolling region<br>
         This is the scrolling region<br>
         This is the scrolling region<br>
         This is the scrolling region<br>
         This is the scrolling region<br>
         This is the scrolling region<br>
         This is the scrolling region<br>
         This is the scrolling region<br>
         This is the scrolling region<br>
         This is the scrolling region<br>
      </div>
   </body>
</html>

The second technique, suggested by Rich Igou, instead uses a table to force the sizing of the div tag.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
   <head>
      <title>Non-Scrolling Region Example</title>
   </head>
   <!—Authored by: Rich Igou - Rapattoni Corporation-- >
   <body scroll="no" style="margin:0">
      <table height="100%" width="100%" cellpadding="0" cellspacing="0">
         <tr>
            <td height="40" style="background-color:silver">
               This is the non-scrolling region<br>
               This part won't scroll
            </td>
         </tr>
         <tr>
            <td>
               <div style="height:100%;width:100%;overflow:auto;">
                  This is the scrolling region<br>
                  This is the scrolling region<br>
                  This is the scrolling region<br>
                  This is the scrolling region<br>
                  This is the scrolling region<br>
                  This is the scrolling region<br>
                  This is the scrolling region<br>
                  This is the scrolling region<br>
                  This is the scrolling region<br>
                  This is the scrolling region<br>
                  This is the scrolling region<br>
                  This is the scrolling region<br>
                  This is the scrolling region<br>
                  This is the scrolling region<br>
                  This is the scrolling region<br>
                  This is the scrolling region<br>
                  This is the scrolling region<br>
                  This is the scrolling region<br>
               </div>
            </td>
         </tr>
      </table>
   </body>
</html>

To see an example of these, check out nonscrolling1.html and nonscrolling2.html. Size your browser window smaller than the text in the non-scrolling region to see the effect.


Top