CodePen - Smooth Horizontal Scrolling
In the era of responsive design, often times we will have a series of card-like divs.
Tailored Jeans
$19.99
Some text about the jeans.
Card
Card
Card
Card
Card
Card
Card
Card
To make this, we need to create a container that holds our cards. Then we will enable horizontal scrolling on that container.
The overflow-x and overflow-y enable the div to only scroll horizontally. The combination of white-space: nowrap and display: inline-block will neatly line up the cards.
We can also use Flexbox to achieve the same result.
ఈరోజు ముఖ్యమంత్రిగా నియమించబడి ఒరిస్సాలో మరిన్నిసార్లు బిజెపి అధికారంలోకి రావడానికి దిక్సూచిగా మారబోతున్నారు 🙏🙏🙏🙏 " మరో సామాన్య కార్యకర్త ట్రైబల్ బిడ్డ " ను అందలమెక్కించిన బిజెపి కేంద్ర పెద్దలకు హృదయపూర్వక ధన్యవాదములు.🪷🪷🪷🙏🙏
The result is the same. We have all our cards on a single line and they are scrollalble left to right.
Card
Card
Card
Card
Card
Card
Card
Card
Card
On iOS, you want to add -webkit-overflow-scrolling: touch; to your scroll container. By default, Safari will not smoothly scroll these elements.
I wrote a blog post on this topic if you want to learn more.
