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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:03:56+00:00 2026-06-18T00:03:56+00:00

I want to make a header div (like a banner) fixed only when the

  • 0

I want to make a header div (like a banner) fixed only when the header is trying to go out of the screen as the user scrolls down. Is it possible to do without using JS? For an example in Facebook timeline, if we scroll down a banner floats up as soon as the page’s header goes out of the screen. My question is, is it possible to do with only CSS?

In case it is not clear enough, I want to know whether a style “position: fixed” can be applied conditionally like when 80px of the page is scrolled.

  • 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-18T00:03:57+00:00Added an answer on June 18, 2026 at 12:03 am

    Yes. You can do it with just CSS. This is done by having a normal scrolling header, placed above a fixed one, which shows up only after the normal one scrolls up above it. This is kind of how http://techcrunch.com is doing it.

    Update [10/31/2013] – Techcrunch changed their UI recently so you cannot see this there anymore!

    Check this demo: http://jsfiddle.net/WDnyb/2/

    HTML

    <div class="header">Header</div>
    <div class="outer">
        <span class="banner">LOGO</span>
        <div class="header">Header</div>
    </div>
    <div class="content">Content</div>
    

    Relevant CSS

    .header {
        width: 100%;
        position: fixed;
        top: 0;
        bottom: auto;
    }
    .outer {
        position: relative;
        height: 100px;
    }
    .outer .header {
        position: absolute;
        bottom: 0;
        z-index: 2;
        top: auto;
    }
    .content {
        height: 1500px;
        margin-top: 100px;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For example,I want to make a layout like this: The 'header' can have a
Possible Duplicate: How do I make a Div move up and down while Scrolling
I want to use conditional comments to make a DIV appear ONLY in browsers
Im trying to make a fixed menu like on this site: http://www.thethingswemake.co.uk/web_carsonified.htm The menu
I want to make a website where the (dynamic in height) header and footer
I want make datetimepicker in my project. Using jquery how it is possible? I
I want make interactive application where user launches it and can do various task
I have a header set up like this: <div id=header> <div class=container_16> <div class=grid_4><img
I'm trying to make some Post Application which has to show messages like the
I just want to make everything in the 'wrapper' stretch out to fit the

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.