The official suggestion is to add a fixed width to the parent element to scroll,
The first scheme
Get the width of each element, ele. Offsetwidth
, and add it up. Finally, add ele. Style. Width = 'cumulative width'
to the parent element
The second scheme
It is recommended to use this scheme directly, so it is not necessary to calculate the width of each sub element
Parent element: Display: inline block; white-space: nowrap; Code> sub element:
Display: inline block
You can scroll directly ~.