-3

I need text be above the image, so I set z-indexto 10, and image to 5.

Text is in Navbar.

function ProductList2(props: OrganizationList2) {
  return (
    <div>
      <div className={styles.container1}>
        <Navbar />
        <img
          src="/Olovka_Studio_gyűrű_v2.png"
          width="100"
          height="140"
          className={styles.img1}
        />
.container1 {
  background-color: #12341b;
  position: relative;
  height: 38vw; /*543/1440*/
}

.img1 {
  position: absolute;
  right: 11vw; /*159/1440*/
  top: 0px;
  z-index: 5;
  height: 38vw;
  width: 24vw; /*372/1440*/
}

.container { /* <------------------ Inside Navbar*/
  display: flex;
  margin-left: 8vw; /*128/1440*/
  margin-right: 8vw; /*430/1440*/
  justify-content: space-between;
  max-height: 88px;
  z-index: 10;
}
János
  • 32,867
  • 38
  • 193
  • 353

1 Answers1

1

An element with z-index doesn't work without a position element

Try:

.div-with-z-index {
   position: relative /* Relative doesn't change the position of the element itself. */
}
PRSHL
  • 1,359
  • 1
  • 11
  • 30