Using a Content Editor Web Part to enforce vertical scrolling
- Create the initial web part. By default, it should expand to utilize as much vertical space as it needs.
- Edit the web part as usual. Under the Appearance category, set the "Height" property to the desired size.
Save the changes and view the page. It will appear just as before, but our desired size will be saved for later.
- One piece of information we’ll need to know is the HTML ID of the div containing our web part, which is in the format "WebPartWPQx", where "x" is a number. Finding this web part identifier in the page’s HTML allows us to write CSS for a specific section.
The easiest way I’ve discovered to find a web part’s ID is to view the page’s source (right-click, View Source) and to search for the string "<span>" followed by the web part’s title. In our example, we’ll search the page’s source for "<span>Sample Vertical List", which yields the following:
This shows the ID of our caption, and its number (3) tells us the ID of the web part we’re looking for (WebPartWPQ3). We’ll need this in step 7.
- Now, go to edit the page as normal. On the edit page, select "Add a Web Part".
- Under Miscellaneous, select "Content Editor Web Part". This web part allows you to insert pure HTML into the source of a given page.
- Modify the shared web part. From the tool pane, select "Source Editor…"
- Enter the required HTML to change the desired web part’s style. In this case, we’re going to insert a CSS style block to override the default behavior for a given web part. If our web part has an ID of WebPartWPQ3 (as found in step 3), we’ll add:
You could alternatively set the property to "scroll" instead of "auto" if you’d like both horizontal and vertical scrollbars to appear regardless of height.
- While still editing this web part, set its "Hidden" property to true (found under the Layout category). This is to prevent users from seeing a "Content Editor Web Part" when viewing the page. The custom HTML will still function.
- Upon saving your changes, the web part should now display with its fixed height and scrollbar when needed.
- In order to adjust the height, repeat step 2.
This process is probably a bit involved for what seems like a simple requirement. Microsoft should have anticipated users’ needs and manually set the overflow property instead of deferring to the browser’s default behavior. Hopefully this limitation is addressed in a future version of SharePoint.