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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:49:43+00:00 2026-06-16T05:49:43+00:00

I have a problem trying to make a flexible absolutely positioned element inside relative

  • 0

I have a problem trying to make a flexible absolutely positioned element inside relative positioned element. Here is the code:

http://jsfiddle.net/cxHNN/

The above code works fine when the .content div inside the .active div has the largest height value. (inner-3 in this case)

But if the .active class is set on any other inner element (with less text), the content from largest element (inner-3) overflows (see example here).

I can work this out using JavaScript, but I would like a pure css solution to this problem, such that all the inner elements are of equal heights without giving a fixed-height so that their height dynamically changes as the container-width changes (in a responsive layout).

Note:
Nevermind the pixel-based margins/widths. I had to tweak the css a little to make it work jsFiddle. They’re all in % or ems in my original stylesheet.

  • 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-16T05:49:44+00:00Added an answer on June 16, 2026 at 5:49 am

    Try hiding all .inner divs, and only show the active div?

    .inner .content {
        background: none repeat scroll 0 0 #CCCCCC;
        margin-top: -4em;
        padding: 0.5em;
        display: none;}
    .inner.active .content{
        display: block;
        }
    

    UPDATE: If you need the inner divs to be the same size, you can’t position them absolutely, or float them, or display them hidden or inline. So, I’ve done thie following:

    • The flex container is positioned relative, and given enough padding that the elements inside it can be positioned top left, and position correctly. I have also set the font size 0 and prevented wrapping.
    • The inner div is displayed inline-block, with a width of 0
    • The active inner block is given a 100% width, so that it is the only one shown
    • The H1s are positioned absolutely, and placed where you want them

    http://jsfiddle.net/cxHNN/4/

    You will need to play with the padding and spacing and stuff. Oh, and I only tested this on FireFox – there may be issues with other browsers.

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

Sidebar

Related Questions

Trying to make information about image below it. But have A problem... Pseudo element
I have problem in my PHP code. I'm trying to make internet shop and
Trying to make simple minesweeper game in python, but have one problem. I have
I have a huge problem with this method im trying to make. I have
I have a problem trying to turn my python code into an executable using
I have a puzzling problem with trying to make an ajax/static state program. What
I have a problem trying to make an alias for new column and using
I always have a problem trying to figure out the best way to make
I have a problem trying the following with nHibernate: Eager loading. Use selects (here
I have a problem trying to understand the code of a basic nodelist. The

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.