0

Consider the following code:

nav{
  background-color: red;
  width: 150vw;
  height: 50px;
}

section{
  overflow: auto;
}

main{
  display: grid;
}
<main>
  <div>
    <section>
      <nav></nav>
    </section>
  </div>
</main>

I want to do the section element scrollable. If I don't set display: grid in the main element, the section element is scrollable.

Same result, if I set overflow: auto for the div or main elements.

Why is that?

EDIT: Notice that I want to keep the original nav size, and make it scrollable (instead of making the whole page scrollable)

José Luis
  • 3,713
  • 4
  • 33
  • 37

0 Answers0