javascript - css carousel chart adapts to layout problem
给我你的怀抱2017-06-13 09:23:41
0
3
1072
Similar to the carousel layout, the outer blue container does not set the width and is 100% adaptive. The width of each sub-container is equal to the width of the parent container and is displayed in one row. The part beyond the parent element is hidden. Can this be achieved using js?
I thought of two methods: flex and inline-block The width of the container is set for easier observation. Logically speaking, it is also possible to use positioning. But you have to set the positioning one by one, so I didn’t do it.
Similar effects can be achieved simply by relying on CSS:
jsfiddle.net to see if it’s what you want
I thought of two methods: flex and inline-block
The width of the container is set for easier observation.
Logically speaking, it is also possible to use positioning. But you have to set the positioning one by one, so I didn’t do it.
https://jsfiddle.net/m41tLwqb/1/
https://jsfiddle.net/2zcqqj26/
I used pure CSS to make a carousel. As for what you mentioned, it should be possible, but I haven’t done it myself, so I can’t be sure