Setup a portion of html page as scrollable?

Joined
Jan 7, 2025
Messages
17
Reaction score
0
No, its a mistake there. I have tried a lot, and that one I missed.
I corrected that one:

HTML:
<!DOCTYPE html>
<html>
    <head>
        <style>
            .split {
                height: 100%;
                width: 50%;
                position: fixed;
                overflow-y: auto;
                overflow-x: hidden;
            }


            .left {
                height: auto;
                overflow-x: hidden;
            }


            .right {
                right: 0;
                background-color: #ddd;
            }
            .top-right {
                height: 475px;
                overflow-x: hidden;
            }
            .bottom-right {
                height: calc(100% - 475px);
                overflow-y: auto;
            }
        </style>
    </head>
    <body>
        <div class="split left">
            <h2>Left Section</h2>
            <p>This is the left half of the page. - auto (scroll if much content)</p>
        </div>
        <div class="split right">
            <div class="top-right">
                <h2>Right Section</h2>
                <p>This is the right half of the page - top (fixed)</p>
            </div>
            <div class="bottom-right">
                <p>This is the right half of the page - bottom, auto (scroll if much content)</p>
            </div>
        </div>
    </body>
</html>
But the split left is not scrollable if I put there big content.
 
Joined
Jul 4, 2023
Messages
573
Reaction score
77
Check this out:
HTML:
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
   
    <style>
      html,
      body,
      body * {
        margin: 0;
        padding: 0;
        box-sizing: border-box; /* works in Trident (IE11) */
        overflow: hidden;
      }
      .split {
        height: 100%;
        width: 50%;
        position: absolute; /* works in Trident (IE11) */
      }
      .left {
        left: 0;
        height: 100%;
        overflow-y: auto;
      }
      .right {
        right: 0;
        background-color: #ddd;
      }
      .top-right {
        height: 475px;
      }
      .bottom-right {
        height: calc(100% - 475px);
        overflow-y: auto;
      }
      .left,
      .top-right,
      .bottom-right {
        padding: 8px;
      }
    </style>
  </head>
  <body>
    <div class="split left">
      <h2>Left Section</h2>
      <p style="height: 2000px">This is the left half of the page - auto (scroll if much content)</p>
      <p>Lorem</p>
    </div>
    <div class="split right">
      <div class="top-right">
        <h2>Right Section</h2>
        <p>This is the right half of the page - top (fixed)</p>
      </div>
      <div class="bottom-right">
        <p style="height: 2000px">This is the right half of the page - bottom, auto (scroll if much content)</p>
        <p>Lorem</p>
      </div>
    </div>
  </body>
</html>
 
Joined
Jan 7, 2025
Messages
17
Reaction score
0
Works great! I'll implement it in the real application and I'll let you know. Thank you a lot!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,210
Messages
2,571,091
Members
47,692
Latest member
RolandRose

Latest Threads

Top