When I utilize position absolute, the elements start overlapping each other

I am currently working on displaying sidebar content within tabs, and I need to adjust the height dynamically based on the content. However, I encountered an issue where the elements above and below the tabs are overlapping. To address this problem, I removed the CSS property position: absolute;. While this did resolve the overlap, it caused the second div to fall down to the bottom of the page.

Check out this fiddle


          .tabs {
            /* CSS styling for tabs */
          }

          /* More CSS rules here */
          
        
      

          <!-- HTML code snippet -->
        
      

Answer №1

To make the checked content display properly, ensure that you include "position: relative":

.tabs input.tab-selector-1:checked ~ .content .content-1,
.tabs input.tab-selector-2:checked ~ .content .content-2,
.tabs input.tab-selector-3:checked ~ .content .content-3,
.tabs input.tab-selector-4:checked ~ .content .content-4 {
  z-index: 100;
  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
  filter: alpha(opacity=100);
  opacity: 1;
  -webkit-transition: opacity ease-out 0.2s 0.1s;
  -moz-transition: opacity ease-out 0.2s 0.1s;
  -o-transition: opacity ease-out 0.2s 0.1s;
  -ms-transition: opacity ease-out 0.2s 0.1s;
  transition: opacity ease-out 0.2s 0.1s;
  position:relative;
}

Check out the updated fiddle here

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The void on the right side of the Safari browser

I am seeking assistance as I have encountered a problem on my website built using bootstrap 4.1. You can find my website at . The site functions correctly in chrome, firefox, opera, and IE, but when viewed on Safari, there is an unexpected white space on t ...

Discovering the compiled CSS file in React when using Sass: A step-by-step guide

In my React project, I have incorporated SASS. Now I am looking to find the final compiled CSS file from that SASS code. Whenever I navigate to: While there is the SCSS file visible, where can I locate the CSS version? I am referring to the compiled outp ...

Replicate the ctrl+/- function through coding

While browsing with your browser, you have the ability to adjust the font size by using CTRL + + or CTRL + -. Is there a way to replicate this functionality through code, such as with JavaScript? I am looking to add buttons on my website that allow users ...

How to adjust animation timing for various elements during a CSS 3D flip with a delay?

Here is a CSS flip setup that I have been working on in this fiddle: http://jsfiddle.net/6r82fzk6/ The Goal: I am trying to achieve a slower transition for the back element compared to everything else. The idea is to have the child element of the back fac ...

The "Sticky" directive in AngularJS causes an issue where it extends beyond the width of the parent

Utilizing the Angular JS sticky directive, I am attempting to affix the header of a table to the top of the page during scrolling. The table resides within a bootstrap container with a fixed width. However, when the Angular script kicks in, the entire head ...

Vertical stability bar

I need help creating a vertically fixed navigation bar for my website. Currently, I am using a method that has been discussed in various posts: HTML: <html> <head> src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js">< ...

What are some ways I can ensure that my personalized bootstrap navbar adjusts to different viewport sizes?

I've created a custom navbar that fits perfectly on a screen that is 1300 pixels wide by 700 pixels high. https://i.sstatic.net/nOm0c.png However, when the viewport size is reduced, the navbar elements become misaligned: https://i.sstatic.net/zBqpQ ...

What is the solution to making flexbox align-items flex-end work in WebKit/Blink?

I'm attempting to embed one flexbox within another flexbox. The outer box is aligned vertically: +------+ | | +------+ | | | | | | +------+ The top section adjusts to fit the content with flex 0 1 auto, while the bottom half occu ...

The functionality of Image Map is operational in Chrome and FireFox, but encountering issues in Internet Explorer

Hey everyone, I've been struggling with this issue for weeks now. My image map works perfectly in Firefox and Chrome, but for some reason, it's not functioning in Internet Explorer. Could someone please take a look at my code and help me figure o ...

Behavior of floating footer in Wordpress across different web browsers is inconsistent

I'm facing an issue with the footer of my WordPress website, where it behaves differently in Chrome and Firefox. In Chrome, the right part of the footer seems to be moving out of alignment with the left part, while it displays correctly in Firefox. Y ...

broken alignment of right-aligned Bootstrap navbar

I need help with displaying a navbar on my webpage. I want the right side of the navbar to show different elements based on whether the user is logged in or not. If the user is not logged in, it should display "Login" and "Register," and if they are logged ...

The svh/lvh units are experiencing unexpected issues when using Chrome on an iPhone

I'm facing an issue with my hero section that is supposed to take up the full height of the viewport. I recently tried using the new svh/lvh units, which seemed to work fine on desktop and Safari for mobile. However, when testing on Chrome for mobile ...

Gradual disappearance of preloader as the page loads

I'm facing an issue with setting a gif as a website preloader. Despite trying different JavaScript solutions, the preloader remains visible even after the page has finished loading. $(window).on("load", function() { $(".loading").fadeOut("slow"); ...

What is the technique to shift the blocks to the adjoining column?

https://i.sstatic.net/6jeHV.png Will these elements flow into the adjacent column as I continue adding more of them? GS0 represents the background and block is a class defining the block. .GS0{ min-height: 90vh; display: flex; justify-content: ...

Page Transition Malfunction

Hey there, Just wanted to check in and see how you're doing. I've been working on my Cargo portfolio, and it's almost ready to go. However, I've run into a small issue. Every time I try to navigate between pages, I keep experiencing ...

Different width, same height - images arranged side by side in a responsive layout

The problem lies in the images: https://i.sstatic.net/rydNO.png Here is an example of desktop resolution: https://i.sstatic.net/uv6KT.png I need to use default size pictures (800x450px) on the server. This means I have to resize and crop them with CSS to ...

I'm having trouble getting my CSS opacity to smoothly transition back to its original state of .5 using setTimeout(). What could be

I recently started learning JS, Jquery, and CSS. My goal is to create a Simon Says style game. However, when I attempt to animate the computer to automatically light up the correct square, I faced some challenges. To address this issue, I decided to star ...

Challenges with Html design

Hey there, I've got this HTML and CSS structure that I'm working on. My goal is to have all four divs in one line. Can someone please take a look and let me know what I might be doing wrong? Here's an example: https://jsfiddle.net/0ynnfmo5/ ...

Slider with Dual Images: A Visual Comparison

I'm currently working on a webpage that features before and after images using a slider based on mouse movement to display both pictures. I am trying to incorporate multiple sliders on the same page but have been facing difficulties in getting them to ...

CSS query: How to eliminate the extra space at the top of a webpage?

How can I eliminate the gray area visible here: The padding in style.css is currently set to: padding: 0; I have attempted to modify this by changing the following: #page { margin-top: 0; } I have tried variations such as: #page { margin-top: 5px !im ...