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

The Archive Base Latest Questions

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

i have this html and css code: <div class=header> </div> .header { top:0; left:0;

  • 0

i have this html and css code:

<div class="header">

</div>

.header {
    top:0;
    left:0;
    right:0;
    width:100%;
    background:#3b5998;
    height:95px;
    margin-bottom: 50px;
position:fixed;
}

What i’m trying to do here is the header should be in the fixed position (top) whenever the user scrolls down. I have no problem with that. I easily accomplished that task.

I want to add a different styling on it when the user scrolls down. I want to add a box shadow effect on it when the user scrolls down so it will look elevated. If the user scrolls up and reached the top portion of my webpage, it will revert back to the default css style (which has no box shadow).

More like saying:

scrolled down = activate box shadow effect

if scrolled up and reached the top = revert back

I am not aware of any css code for this, maybe someone will help me with their javascript/jquery expertise to make a code?

sorry if my explanation is too long or a little confusing. Thank you very much!

  • 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-18T10:56:54+00:00Added an answer on June 18, 2026 at 10:56 am

    Try like this

    $(window).scroll(function(){
    if (document.body.scrollTop === 0)
         $(".header").css({"box-shadow":"none"});
    else
         $(".header").css({"box-shadow":"0px 0px 1px #EEE"});
    });
    

    See Demo For Reference only

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

Sidebar

Related Questions

I have this html: <div class=foo parent> <div class=child></div> </div> with some css: .foo{
i have this html code <table style=width: 100%;> <tr> <td> ID </td> <td> <input
I have this html code <div id=b_container> <div id=b_header> <div class=header_left><a href=#>link 1 </a></div>
let's say I have this set of HTML-markup and CSS #CSS .inputhelp_text { background:
I have this html table: <table class=table-all> <tbody> <tr> <td>BISFENOLO</td> <td>Bisfenolo-AF 10/10</td> <td class=right>€
I have this HTML structure <div class=buttons> <button data-icon=ui-icon-disk class=save>Save1</button> <button data-icon=ui-icon-check class=ok>OK1</button> <button
I have the following CSS in LESS format: body { width: 100%; background: #F4F4F4
I have the following html and css <div id=header> <div id=headerTopLeft> <div id=areaSelect style=display:
Suppose a HTML like this: <div id=header> <span class=title>Title</span> <!-- more spans and other
I want to achieve this using html and css: I have tried to set

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.