Remove the scroll bar in the Document Library web part on a SharePoint page.

John Countryman 1 Reputation point
2022-02-18T15:23:28.777+00:00

I am using Modern Sharepoint web based and have created page which I have added my Document library to. The Document library is added as a iFrame with a vertical scrollbar for this section. Is there a way to set the length of the page to remove this scroll bar?

175922-4f5501f7-01e9-42e3-8b83-47f265dd719b.png

Here is a response I received from another group

Based on my test, if the number of files in the library is less than 40, then you could edit the web part and select "Autosize" under Size part. This did not work

175887-892f4513-1b68-4222-b463-c7807d4fac76.png

However, if the number of files in the library is more than 40, even you select the "Autosize" option, the scroll bar will still appear.
Given this situation, since there is no out of box way to meet your requirement, it may need some customization code, we suggest you can go to sharepoint-dev - Microsoft Q&A, the members and engineers in this community are more experienced in this area, they may provide the customized code about it.

Microsoft 365 and Office SharePoint For business Windows
{count} votes

1 answer

Sort by: Most helpful
  1. Emily Du-MSFT 51,836 Reputation points Microsoft External Staff
    2022-02-21T07:58:53.163+00:00

    @John Countryman

    You could use CSS codes in the modern script editor web part on your page.

    1.Insert a modern script editor web part on your page.
    2.Add below codes in the modern script editor web part.
    <style>
    div[data-automation-id^='detailsListContainer']:hover {
    overflow-y: hidden !important;
    }
    </style>
    3.Result.

    176265-1.png


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.