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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:50:42+00:00 2026-06-11T12:50:42+00:00

I have made a div and I have given it position: fixed using this

  • 0

I have made a div and I have given it position: fixed using this style sheet:

CSS

position: fixed;
top: 35px;
z-index: 9999;
height:60px;
background:#000;
width:100%;

Now what I want is:
if this div has height zero, then the div which is just after should come in place of the above div.
if the height of div is not zero, the next div after this div should have a margin from the above div so both div will not overlap each other.

  • 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-11T12:50:43+00:00Added an answer on June 11, 2026 at 12:50 pm

    When you have an element that is fixed (or absolute), there is no element after it. The fixed element is taken out of the document flow.

    If you want two elements after each other at a fixed position, make a container that is fixed, and put the two elements inside it.

    You can put another container with a top-margin around them, and set a top-margin on the second element. If the first element is empty, there is nothing to have a margin to, so the margin will collapse outside the container and the second element will be at the top of the container.

    (The second container is needed because the margin will not collapse outside the fixed element.)

    Demo: http://jsfiddle.net/Guffa/r5crS/

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

Sidebar

Related Questions

I have made this code: var foo=document.createElement(div); var childs=foo.getElementsByTagName(*); console.log(childs.length);//0 OK var a=document.createElement(a); foo.appendChild(a);
Here's the HTML <div class=panel id=Panel1> <fieldset style=position: absolute; top:8px; left: 136px; width: 136px;
I have a sliding div menu made with jQuery, but you have to click
I have a custom Checkbox its made in a Div <div class=zs name=toggle state=on
I have a div element which is made jquery Resizable. It has alsoResize option
I have a simple nav made up of the following HTML; <div class=inner> <div
I have made an application for IPad in objective C. In this I am
So I made this super stripped down version of a html css jquery navigation
Context I have a div with overflow: auto property. In this div , I
i have view which looks something like this : <% using (Ajax.BeginForm(new AjaxOptions {

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.