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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:58:46+00:00 2026-06-10T20:58:46+00:00

<div id=foo> <div></div> <div id=bar></div> <div></div> </div> How do you get top of bar

  • 0
<div id="foo">
    <div></div>
    <div id="bar"></div>
    <div></div>
</div>

How do you get top of “bar” to be positioned -5px relative to its original position and also removed from the normal flow?

Attempt 1

#bar {
    position: relative;
    top: -5px;
}

Doesn’t work since “bar” is not removed from normal flow

Attempt 2

#foo {
    position: relative;
}
#bar {
    position: absolute;
    top: -5px;
}

Doesn’t work since top of “bar” is placed -5px relative to “foo”

  • 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-10T20:58:48+00:00Added an answer on June 10, 2026 at 8:58 pm

    Try

    #bar {
        position: absolute;
        margin-top: -5px;
    }
    

    See this live example

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

Sidebar

Related Questions

The following code does not return anything: $('.foo', $('<div class=foo>foo</div><div class=bar>bar</div>').get(0)).html() Is there any
I have the following code: HTML <div id='foo'> <input type='checkbox' value='english' name='bar[english]' /> <input
Example: <div>foo</div> <p>bar</p> Unwrapped text What i want: <div>foo</div> <p>bar</p> <span>Unwrapped text</span> How to
Suppose I have the following HTML: <div id=test> <span style=display:inline;>foo</span> <span style=display:none;>bar</span> <span style=display:inline;>baz</span>
Basically: I have this HTML: <div id=foo><img src=/foo/bar/{var}/foo alt={var}></div> When calling (using jQuery in
Suppose I have an html string like so : var string = '<div><img src=foo/bar
If I run this code - var html= '<html><head></head><body><div class=bar></div></body></html>'; console.log($(html).find('div')); I get no
Here's my sinatra code: get '/' do foo = 'not bar' erb :index end
Assuming I have HTML similar to this: <div class=fooContainer> <div class=barContainer> <a href=#>foo-bar</a> </div>
<style type=text/css> div#foo { background: #0000ff; width: 200px; height: 200px; opacity: 0.30; filter: alpha(opacity

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.