css - Display a popup-menu in front of a table -


i've created menu each table row displayed on hover. working except 1 thing: if hover on last rows menu, menu should popup in front of tables container instead of creating scrollbar inside container..

screenshot of real application example

see example here:

.container {    max-height: 70px;    overflow-y: scroll;  }  table {    width: 100%;  }  .menu-container {    position: relative;  }  .menu-container ul {    padding: 0px;    margin: 0px;    border: 1px solid black;    background-color: gray;  }  .menu-container ul:hover {    position: absolute;    margin-top: -10px;    width: 100%;  }  .menu-container ul li {    display: none;    list-style-image: none;    margin: 0px;    padding: 0px;    width: 100%;  }  .menu-container ul:hover li {    color: red;    display: block;    margin-bottom: 0px;  }
<div class="container">   <table border="1">    <tbody>     <tr>      <td>        <div class="menu-container">          <ul> col1            <li>menu 1</li>            <li>menu 2</li>            <li>menu 3</li>            <li>menu 4</li>            <li>menu 5</li>            <li>menu 6</li>            <li>menu 7</li>            <li>menu 8</li>          </ul>        </div>          </td>      <td>        col 1      </td>      <td>        col 2      </td>      <td>        col 3      </td>      <td>        col 4      </td>    </tr>    <tr>      <td>        col 1      </td>      <td>        col 1      </td>      <td>        col 2      </td>      <td>        col 3      </td>      <td>        col 4      </td>    </tr>    <tr>      <td>        col 1      </td>      <td>        col 1      </td>      <td>        col 2      </td>      <td>        col 3      </td>      <td>        col 4      </td>    </tr>          <tr>      <td>        col 1      </td>      <td>        col 1      </td>      <td>        col 2      </td>      <td>        col 3      </td>      <td>        col 4      </td>     </tr>          </tbody>   </table>  </div>

https://jsfiddle.net/6ty7uwup/1/

actual , expected behaviour

do have tips me? thanks!

the problem positioning in css. container shouldn't have position attribute keep in it's position.

later should have absolute position keep li above all.

here fixed css:

.menu-container {  } .menu-container ul {   padding: 0px;   margin: 0px;   border: 1px solid black;   background-color: gray; } .menu-container ul:hover {   position: absolute;   margin-top: -10px; } 

Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -