0

i want to make div "menu" in the bottom fixed even if scrolling is there any way i could do it please any help

.overflow{
      width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.2);
    position: absolute;
    inset: 0px;
    display: block;
}
.menu{
      display: flex;
    flex-direction: column;
    position: relative;
    margin-top: auto;
    background-color: white;
    border-radius: 12px 12px 0px 0px;
    max-height: 90%;
    transform: translateY(0px);
    transition: transform 250ms ease-out 0s;
}
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div class="overflow">
  </div>
  <div class='menu'>
   <h1>item 1 </h1>
    <h1>item 1 </h1>
  
  </div>
</body>
</html>

i want to make div "menu" in the bottom fixed even if scrolling is there any way i could do it please any help

sPEER PANSER
  • 13
  • 1
  • 5

1 Answers1

0

Replace position: relative to position: fixed on menu, and style it take position in the bottom with left: 0 and bottom: 0:

.overflow {
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.2);
  position: absolute;
  inset: 0px;
  display: block;
  min-height: 2000px;
}
.menu {
  /*  Add these */
  position: fixed;
  left: 0;
  bottom: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  margin-top: auto;
  background-color: white;
  border-radius: 12px 12px 0px 0px;
  max-height: 90%;
  transform: translateY(0px);
  transition: transform 250ms ease-out 0s;
}
<div class="overflow">
</div>
<div class='menu'>
  <h1>item 1 </h1>
  <h1>item 1 </h1>
</div>
John Li
  • 6,976
  • 3
  • 3
  • 27