Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4554370
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T17:04:47+00:00 2026-05-21T17:04:47+00:00

Guys, I have the following HTML. Is it possible for the #underdiv to scroll

  • 0

Guys, I have the following HTML. Is it possible for the #underdiv to scroll under the #topdiv? I want to achieve the effect of having a list of items and to be able to scroll it up and down while keeping the #topdiv always visible on top of it. Can it be done just with the CSS or do I have to add some Javascript magic? I also have JQuery and JQueryMobile (as this is meant for an iOS device) included in the file but I kept them out to make the HTML look simpler.

Thanks in advance for helping me out!

<!DOCTYPE html> 
<html>
<head>
    <title>test</title>
    <style>
        #underdiv {
            background-color: red;
            position: relative;
            top: -40px;
            width: 80%;
            margin: 0 auto;
        }
        #topdiv {
            background-color: yellow;
        }
    </style>
</head>
<body>
    <div id="topdiv">
        <h1>Random title</h1>
        <p>This is a random paragraph bla bla bla bla yada yada yada</p>
    </div>
    <div id="underdiv">
        <ul>
            <li>Item 1</li>
            <li>Item 2</li>
            <li>Item 3</li>
            <li>Item 4</li>
            <li>Item 5</li>
            <li>Item 6</li>
            <li>Item 7</li>
            <li>Item 8</li>
            <li>Item 9</li>
            <li>Item 10</li>
            <li>Item 11</li>
            <li>Item 12</li>
            <li>Item 13</li>
            <li>Item 14</li>
            <li>Item 15</li>
            <li>Item 16</li>
            <li>Item 17</li>
            <li>Item 18</li>
            <li>Item 19</li>
            <li>Item 20</li>            
        </ul>
    </div>
</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T17:04:48+00:00Added an answer on May 21, 2026 at 5:04 pm

    it’s possible, though the scrollbar disappears under too;

    ul {
        margin: 0; 
        padding: 40px 0 0 30px;
    }
    
    #underdiv {
        background-color: red;
        width: 80%;
        margin: 0 auto;
        height: 200px;
        overflow: auto;
        margin-top: -40px;
    }
    
    
    #topdiv {
        background-color: yellow;
        padding: 1px; /* to stop margins collapsing */
        position: relative;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey guys, I have the following HTML structure that I am trying to pull
Hi guys lets say I have the following html: <div class=owner> <div> <a href=javascript:void(0)
Hi guys i have the following string &|L1|L2|L3|& I would like to extract L1
Can you guys help me figure this out? I have the following JavaScript snippet:
Hey Guys, i have created the following Menu Structure: <div id=menu> <ul> <li><a href=#>Main
Python list comprehensions are nice, but near impossible to debug. You guys have any
Hei guys, I have the following problem: As I can see those arrows are
I have a javascript program to filter a list of things in a HTML
Hey guys, I want to make a function loop over all elements that have
I have the following html code: <div id=test> <nav> <ul> <li>One</li> <li>Two</li> </ul> <ul>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.