Place div1 above div2 by using a relative position to div3 for div2's absolute positioning

The content on the page is currently being displayed above an absolute dropdown menu that offers more options in relation to the sticky breadcrumb navigation.

I have attempted to adjust the z-index and positioning, but the only solution I discovered was to remove the relative positioning from the content, which is not ideal.

Is there a way to place 'div2' above 'div1'?

EDIT: https://jsfiddle.net/6ncp7f1q/1/

HTML

<div class="container">
  <div class="breadcrumb">
    Home
    <div class="extra">
      <a href="#">TextText</a>
      <a href="#">TextText</a>
    </div>
  </div>
  <div class="content">
    <p>Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text </p>
  </div>
</div>

CSS

.container{
  display: flex;
  flex-direction: column;
}

.breadcrumb{
  position: relative;
  height: 40px;
  width: 100%;
  background-color: pink;
}

.extra{
  position: absolute;
  background-color: red;
  right: 0;
  top: 40px;
}

.extra a {
  display: block;
  width: 100%;
}

.content{
  position: relative;
  width: 100%;
  color: green;
}

https://i.sstatic.net/mPCRY.png

Answer №3

Adjust the z-index value of the breadcrumb element

.container{
  display: flex;
  flex-direction: column;
}

.breadcrumb{
  position: relative;
  height: 40px;
  width: 100%;
  background-color: pink;
  z-index:99; /* Adjust this value */
}

.extra{
  position: absolute;
  background-color: red;
  right: 0;
  top: 20px;
}

.extra a {
  display: block;
  width: 100%;
}

.content{
  position: relative;
  width: 100%;
  color: green;
}
<div class="container">
  <div class="breadcrumb">
    Home
    <div class="extra">
      <a href="#">TextText</a>
      <a href="#">TextText</a>
    </div>
  </div>

  <div class="content">
    <p>Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text </p>
  </div>
</div>

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

Tips for positioning an UpdateProgress in the middle of a grid view using CSS

Seeking a solution to position an Update Progress indicator in the middle of a Grid view within an Ajax Update Panel. Is there a CSS-only method to achieve this without relying on jQuery or JavaScript, either at the center of the grid view or the center ...

Utilizing a nested div structure for web design

Forgive my lack of expertise in web programming, as my knowledge is limited and I struggle with finding the right terms even through online searches. With that said, my question (which may be worded oddly due to my lack of familiarity with the topic) is: ...

Media query failing to adjust properly

On my website's "about" page, I'm attempting to implement a media query but encountering an issue. In the original CSS, I structured the "information" section into 2 columns with right padding to prevent the content from extending all the way to ...

extracting a HTML element from a website using BeautifulSoup

Image description is: https://i.sstatic.net/m4gxX.png Tag is: https://i.sstatic.net/skHQc.png I attempted to extract data from the stock dropdown menu but encountered a problem while trying to access the information. I identified the tag in the source ...

Guide on displaying a partial form as a horizontal form in Rails 4

I am facing an issue with displaying a form horizontally instead of vertically in a partial triggered by AJAX on my main page. I have tried various methods like using <form class="form-inline">, <%=f.number_field :pointsSpend, :class => "checkb ...

Learn how to configure an Angular2 Template Driven form element by implementing two-way binding and integrating template driven form validation techniques

Can anyone help me figure out the correct way to set up an Angular template driven form element for both validation and two-way binding? I've tried using ngModel in different ways, but cannot seem to achieve two-way binding without encountering issues ...

Tips for keeping my wordpress menu at the forefront

This piece of code is responsible for controlling the main menu on my website. Currently, it's set up so that when I scroll down, the menu disappears, and when scrolling up, it reappears. However, I would like the menu to always remain displayed at t ...

Using jQuery to add HTML elements before the content of a list

I'm facing a challenge in dynamically adding new elements to my list. Through ajax, I retrieve HTML data from my database and aim to iterate through each new <li> element to gradually prepend them to the top of the list. This is the snippet of ...

The Jquery .remove() function will only take effect after the second click

I am currently working on implementing a notifications feature using bootstrap popover. The issue I am facing is that after a user clicks on a notification, it should be removed. However, for some reason, it requires two clicks to actually remove the notif ...

Unexpected failure in retrieving data with Javascript Fetch

I'm attempting to create a login form that retrieves data from another website, but I keep encountering an error that says Error: Failed to Fetch Upon inspecting the code, I can't seem to identify any issues, but it's possible that the prob ...

Browse through the options in the dropdown list -Angular 6

I am looking to implement a filtering feature in my Angular app where data can be filtered based on the selected product number from a dropdown menu. The product data is structured in JSON format as shown below. component.ts productlistArray = [{ num ...

CSS: Struggling to Keep Footer at the Bottom of the Page

I've been struggling to get my footer to stick to the bottom of the page, but I just can't seem to make it work. I've searched online for solutions with no success, so I thought I would ask for help here. http://jsfiddle.net/f54eq3w8/ Here ...

What is the best method for retrieving the entire row data based on the maximum value in a column?

function findMaxValue() { var highestValue = Math.max.apply(Math, $('.sira').map(function() { return $(this).text() })) alert(highestValue); } <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"& ...

Once my tables are filled with information, the tables on the left expand to fill the entire screen, while the tables on the right become squished together

I have encountered a frustrating issue that I cannot seem to resolve. When I compile the page, the tables on the left side display correctly as intended. However, once I upload it to my company's intranet and load the data (which is the same), the tab ...

Tips for creating space between words within a <p> element and lining them up with text boxes in the following <div>

Here is the code I wrote for the form: <div class="container-fluid" id="unlabelled"> <p class="bg-primary">Items<span>Quantity</span><span>In Kit</span></p> <form> < ...

Create a layered panel underneath a button that covers a separate element

I am working on a layout that consists of an editor and multiple buttons positioned above it on the right side. My goal is to add a panel just below "Button2" that will overlay the editor. This panel should expand and collapse when "Button2" is clicked, wh ...

The Alchemy feature on hover is not functioning

I am currently using alchemy.js to display a graph, but I am encountering issues with showing the "onMouseOver" caption of the graph's node. The console is displaying some errors which you can see here. Here is the code snippet: <html> < ...

Dynamic content loading using AJAX to selectively update a designated section

I am having trouble displaying the error message in my form. Currently, it is causing my form page to load four times. Can someone help me identify what I did wrong? I only want to display that span: controllers: <?php /* * File Name: user.php */ ...

Thick black border on select list in Internet Explorer version 10

After recently switching to IE10, I couldn't help but notice that all my dropdown lists (select lists) now have a bold black border when in the "dropped down" state, like the example below. Unfortunately, I am unable to inspect the element using IE&ap ...

Concerns with the window's onload function

window.onload = prepareButton; function prepareButton() { document.getElementById('slist').onclick = function() { window.location = "students"; } } Whenever I click on a slist element, which is actually a <p> tag formatt ...