This code sets the overflow property of the .container element to auto, which will display the scrollbar only when the content inside the container exceeds its height. When the scrollbar is not needed, the ::-webkit-scrollbar pseudo-element is set to display: none, which hides the scrollbar. Note that this only works in WebKit-based browsers such as Chrome and Safari.
If you want to hide the scrollbar in other browsers, you can use the scrollbar-width property with a value of none, like this: