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 8047227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:02:18+00:00 2026-06-05T06:02:18+00:00

I have a div , something like this #footer { position:fixed; left:40px; top:0px; }

  • 0

I have a div , something like this

  #footer
   {   position:fixed;
       left:40px;
       top:0px; 
   }

The position is fixed when I scroll vertically or horizontally. But i want the div to be fixed when user scrolls the scroll bar vertically but should be varying when user scrolls the scroll-bar horizontally.

I have seen some of the forums and posts but mostly I found jquery script.I want to know if there is a way to do it in CSS?

Fixed position in only one direction
I read this post but I did not understand the jquery script. Kindly let me know the way to do it in css or the better way to do it with jquery.Thanks

  • 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-06-05T06:02:20+00:00Added an answer on June 5, 2026 at 6:02 am

    Seems to be impossible to get this “look fine” with only CSS/HTML.
    As mentioned from Ruup or Fixed position in only one direction, layering over JS for it, is a good option.

    Fortunately, i found a way to get it work somehow (not that beautiful):
    http://jsfiddle.net/MKEbW/5/

    HTML (inside the body-tag):

    <div id="simulated-html">
        <div id="footer">
            <span>
                <!-- Footer text here -->
            </span>
        </div>
        <div id="simulated-body">
            <!-- Your website here -->
        </div>
    </div>
    

    CSS:

    * { margin:0; padding:0; }
    
    html {
        font: 12px/1.5em Georgia;
    }
    p { padding: 5px; }
    
    html, body {
        height: 100%;
        overflow: hidden; /* hide scrollbars, we create our own */
    }
    
    #simulated-html {
        background: orange;
        overflow-x: scroll; /* force horizontal scrollbars (optional) */
        overflow-y: hidden; /* hide. we use the #simulated-body for it. */
        position: relative; /* to align #footer on #simulated-html */
        height: 100%;
    }
    
    #simulated-body {
        overflow-y: scroll; /* force vertical scrollbars (optional) */
        overflow-x: hidden; /* hide. we use the #simulated-html for it. */
        height: 100%;
        background: #eee;
    
        /* use as a container */
        width: 450px;
        margin: 0 auto;
    }
    
    #footer {
        position: absolute;
        bottom: 0px; /* vertical align it to #simulated-html */
        width: 100%;
        background: red;
        z-index: 99; /* always show footer */
        color: white;
    }
    #footer span {
        width: 450px;
        margin: 0 auto;
        background: green;
        display: block;
    }
    

    ​
    Seems to work in IE7+ and modern browsers, tested via browserlab.adobe.com.

    Tested with scrollbars, smaller and wider viewports in Chrome 18.

    I recommend a fallback for not capable browsers and/or a JS workaround.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have something like this currently: <div class = className style = position: absolute;
Right now I have something like this: <div id=pagebody> <div id=left-entries> </div> <div id=right-entries>
atm I have something like this: $('#fish').append(<div data-bind='foreach: rows'> + <div ... + <p>...</p>..);
So basically I have something like this <div class=iframe-holder> <span></span> <iframe src=iframe.html width=200 height=200
I usually have my structure laid out something like this: <div id=all> <div id=page>
I want to parse a html content that have something like this: <div id=sometext>Lorem<br>
I want to have 3 divs aligned inside a container div, something like this:
I have a setup, something confusing like this: <ListView> <ItemTemplate> <div id=Content> <asp: TextBox
I have something like this: ... <div id=d120 >content</div> <div id=d123 >content</div> <div id=d112
I have a div set up something like this: <div id=test> <p>Hello</p> <p style=display:

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.