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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:42:25+00:00 2026-05-16T22:42:25+00:00

I have some HTML codes like <div id=top style=height: 50px></div> <div id=bottom style=height: 50px></div>

  • 0

I have some HTML codes like

<div id="top" style="height: 50px"></div>
<div id="bottom" style="height: 50px"></div>
<div id="content">Here goes some text</div>

I want the middle div (#bottom) to be positioned on top of the div (#top) and while doing so, the #content div should automatically move up by 50px.

If i code like

<div id="bottom" style="height: 50px; position: relative; top: -50px;"></div>

the #bottom div do moves up but the #content div stays behind.. leaving a 50px gap between.

So how should I position it??

  • 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-16T22:42:26+00:00Added an answer on May 16, 2026 at 10:42 pm

    If I’m understanding correctly, you want to take #bottom and remove it from the regular page flow, placing it over-top-of #top.

    Two ways to take an element out of the regular page flow are position:float; and position:absolute;

    Not knowing what the rest of your page looks like I suggest something like:

    <div id='container' style='position:relative'>
      <div id="top" style="height: 50px"></div>
      <div id="bottom" style="height: 50px; position:absolute; top:0em; left:0em;"></div>
      <div id="content">Here goes some text</div>
    </div>
    

    That will put #bottom in the top, left-hand corner of #container, which is also where #top will be. #container being part of the regular page flow will be right below #top.

    For centering an absolutely positioned element you can do like this:

    <div style="display:table; margin: 0 auto;">  <!-- display:table; to 'shrink-wrap' the div - margin: 0 auto; to center it->
        <div style="position: relative; float:left;"> <!-- float also shrink-wraps -->
            <div id='top'>top div content</div>
            <div id='bottom' style="position:absolute; top:0em; width:100%; text-align:center;"> content of bottom div </div>
            <div id='content'></div>
        </div>
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have html code block like this <div id=some-div> <a href=# class=link-click>some link text</a>
I have the next code with some thumbnails: <div class=gallery-wrap> <div class=gallery galleryid-45 id=gallery-1>
I have a strange situation...(strange for beginners like me not for experts:) In my
I have the following code, but it doesn't put the scrolling div anywhere. All
I have a page with links on the left and data on the right
We are working on a website where we have a Flash element that shows
I have this Chrome Extension, it adds a poke all button under your pokes.
I have an advertisement section on my website. For most users, this loads just
The answer is probably obvious but I have not seen anything I could use
I know the title of this question is stupid, but I couldn't come up

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.