0

The page content is showing above the absolute dropdown with more options relative to the sticky breadcrumb.

I've tried playing with z-index and positions but the only solution I found was to remove the position relative on the content which isn't an option.

How do I get '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 </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;
}

enter image description here

Wanjia
  • 799
  • 5
  • 19

3 Answers3

0
.extra{
  z-index:1;
}

Example here: https://jsfiddle.net/4er5vcop/2/

kost
  • 705
  • 7
  • 18
0

I hope to helpful this

   .extra{
      z-index:1;
    }

here is the result

https://jsfiddle.net/L8mpv79a/

Udara Kasun
  • 2,182
  • 18
  • 25
0

just set z-index to breadcrumb

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

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

.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 </p>
  </div>
</div>
Renato Hoxha
  • 132
  • 5