In an elastic layout, the width of the parent element is not fixed, how to ensure that the child element scrolls horizontally without supporting the parent element?

using flexible layout, I originally intended to make the following page. The width of the right box div2 is the rest of the screen width, and the ul has a lot of li , which can be scrolled horizontally.

clipboard.png

  • html

  • css

clipboard.png

The width of

div2 has been stretched out, and the width of the browser screen has been enlarged.

is there any way to ensure a single screen and allow child elements to scroll horizontally?

Mar.02,2021

div2 plus overflow:scroll is fine. Normally, the width of div2 should be equal to the width of ul 2000, and the extra 40 should be the margin of ul.

Menu