0

Good morning, is there a solution to see the menus entirely in a layout like this?

I saw that working on the overflow the problem is solved, but I need the menu to have overflow-x active.

<html>
  <head>
    <title>Documento senza titolo</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script type="text/javascript">
        function on(div){div.style.height="1000px"}
        function off(div){div.style.height="auto"}
    </script>
  </head>
  <body>
    <div style="background:#99cc66;; height:500px; width:500px;overflow:hidden; ">
      <div style="background:red; height:100px; width:500px;overflow-x:auto;overflow-y:hidden; ">
        <div style="background:#666666; height:20px; width:750px;  padding:10px;margin:10px; ">
        <div onmouseover="on(this);" onmouseout="off(this);" style="background:#FFFFFF;display:inline-block; width:100px;border:1px solid #000000;">Menu 1</div>
        <div onmouseover="on(this);" onmouseout="off(this);" style="background:#FFFFFF;display:inline-block; width:100px;border:1px solid #000000;">Menu 2</div>
        <div onmouseover="on(this);" onmouseout="off(this);" style="background:#FFFFFF;display:inline-block; width:100px;border:1px solid #000000;">Menu 3</div>
        <div onmouseover="on(this);" onmouseout="off(this);" style="background:#FFFFFF;display:inline-block; width:100px;border:1px solid #000000;">Menu 4</div>
        <div onmouseover="on(this);" onmouseout="off(this);" style="background:#FFFFFF;display:inline-block; width:100px;border:1px solid #000000;">Menu 5</div>
        <div onmouseover="on(this);" onmouseout="off(this);" style="background:#FFFFFF;display:inline-block; width:100px;border:1px solid #000000;">Menu 6</div>
        <div onmouseover="on(this);" onmouseout="off(this);" style="background:#FFFFFF;display:inline-block; width:100px;border:1px solid #000000;">Menu 7</div>
        </div>
      </div>
    </div>
  </body>
</html>

enter image description here

I would like this result by keeping the menu overflow-x

corradox
  • 11
  • 3

2 Answers2

0

Set CSS property z-index:100 for menu

Prashant Pimpale
  • 10,349
  • 9
  • 44
  • 84
0

You can add position:absolute to the function on. so it will be:

function on(div){div.style.height="1000px"; div.style.position="absolute"};

Position:absolute take out the element from DOM.

From w3cschool: The element is positioned relative to its first positioned (not static) ancestor element

proti
  • 213
  • 3
  • 11