Distribute stacks of items in the inventory in Minecraft Creative mode?

Wa
2

So, I wanted to distribute the same item in stacks in the inventory in Minecraft Creative mode. I tried Shift + left-click, but the item is simply distributed, not stacked. That's why I would like to know how it works in stacks, because I've seen it that way with YouTubers, maybe it works because they use Optifine, but I do that too, so I would be happy to receive an answer.

Po

You have to hold down the middle mouse button (mouse wheel) and move it over the slots. OptiFine is only responsible for performance and optical things.

Cr

Click on a stack with the mouse wheel and then drag it over the inventory