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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:40:08+00:00 2026-05-18T10:40:08+00:00

I have a relatively positioned div (call it marker) in my markup which influences

  • 0

I have a relatively positioned div (call it “marker”) in my markup which influences the top “y” position of a sibling’s absolutely positioned child div (call it “subject”).

The marker div may or may not be present in the markup. How can I write the css for the sibling child div so that it’s top position is increased by 100px when the marker div is present in the markup.

Here’s the markup when the marker div is present…

<div class="wrapper">
    <div class="marker"></div>  
    <div class="content"></div>
    <div class="sidebar">
        <div class="subject"></div>
    </div>
</div>

The “subject” div is the one I need the conditional height defined in css.

Here’s the markup when the marker div is not present…

<div class="wrapper">
    <div class="content"></div>
    <div class="sidebar">
        <div class="subject"></div>
    </div>
</div>  
  • 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-18T10:40:09+00:00Added an answer on May 18, 2026 at 10:40 am

    Does the following work?

    .sidebar .subject { top: 0px; }
    .marker ~ .sidebar .subject { top: 100px; }
    

    ~ is the adjacent sibling selector; .marker ~ .sidebar matches an element of class sidebar which is after an element of class marker and shares the same parent.

    There’s an excellent tutorial on sibling etc. selectors here.

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

Sidebar

Related Questions

I have a div which needs to be positioned statically / relatively. When it
I have an absolutely positioned div containing several children, one of which is a
I have a div with position: absolute inside a relatively positioned parent. I'd like
I have a relatively -positioned div, which has overflow: auto set. Inside that, I
I have an absolutely positioned div containing several children, one of which is a
i have a container div which is position:relative and the squares are position:absolute because
I have 2 divs, one positioned absolutely right: 0 and the other relatively positioned
I have the following HTML snippet: Block 1: <div style="position: absolute; top: 105px; left:
I have a fixed-width, relatively positioned, and centered #content div (shown as the outer
I have a DIV that is relatively positioned. The whole DIV needs to link

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.