Milind Soorya , still not a fix tho ;) Just try it, really. Unless you're NOT* using box-sizing: border-box , your max-width: 100% will be 100% - the padding on the parent, meaning, the effect "before" and "after" is gonna be exactly the same. I created a pen with your solution and mine underneath: https://codepen.io/Yzoja/pen/bGRvOjY Added the scroll to main to make sure it works just as well when the scroll is visible. *Not using box-sizing: border-box is fairly unsafe, because it means you have to count off every padding with elements set to 100% width. So, if you did it: don't.
