I am relatively new to Salesforce lightning and HTML/CSS. I was trying to create a Custom Grid to display Data with Pagintation(infinite scrolling).

It all went well till i started solving the issue of vertical scroll bar appearing on my page all the time. For pagination, i wanted to display scroll bar only on the grid and not on the entire page(default lightning grid behaviour). The snapshot below explains the problem very well. enter image description here

But, as you can see in the snapshot above, there's an extra scroll bar that appears on the page as well. How do i set the

{ overflow:hidden;}

on the main page?

  • reduce the size of you component height. Scroll bar looks like it is needed in the image
    – Eric
    May 4, 2017 at 12:40
  • @Eric i have not provided any height for any component. Ideally it should only take the space available right?
    – Anee
    May 4, 2017 at 12:42
  • Depending on the classes you used yes. But if you use slds-frame for example it will take 100%vh which includes the size of the header which causes it so be larger than the available viewing window. Its a pain really. So you need to get it a bit smaller using css so the scroll bar does not appear. As it is now how do you expect them to see the bottom of your component/page without it? When you scroll the main scroll bar down what do you see below the fold
    – Eric
    May 4, 2017 at 13:31

1 Answer 1


In addition to my comments above if you really need to do this it can be added to the init handler as such:

document.body.setAttribute('style', 'overflow: hidden;');

Which I have used many times to stop scrolling of main window when a modal is displayed.

  • That works like a charm. I have been breaking my head over this small for a long time. Thanks Eric.
    – Anee
    May 4, 2017 at 18:01
  • Thanks for the solution Eric, this was helpful for me as well. Can you also please have a look on this question posted by me?
    – Sarang
    Jul 31, 2018 at 6:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .