2010, Development Blog, SharePoint
Allow the browser to control the scrollbars in SharePoint 2010 (increasing browser support) when using v4.master.
This article is related to an earlier post on handling security trimming in SharePoint for anonymous websites.
Putting the scrolling onus back on the browser is important for 2 reasons:
- Increase browser support
- Allow mobile rendering (Android has issues rendering div overflows)
This is particularly handy in public-facing websites when you want to remove (not just hide) the ribbon and browse bar (which includes the sign-in controls and Site Actions menu). The public will never need to use the ribbon or Site Actions menu, and you can have a login link in your footer if you need one on the public side.
How do to this:
You might think to yourself: “Hey, why not just dump core4.css?.. isn’t that the root of all my problems?!?” It is important to not just dump out core4.css. Removing it can take out other styles that webparts you are using rely on. Best practice is to have a custom stylesheet and override core4.css where necessary (and surprisingly, it’s pretty simple).
If you are using v4.master as a starting point (which will give you a lot of flexibility):
In your masterpage, remove scroll=”no” from the body, leaving:
Add a custom stylesheet to your masterpage by adding this tag right before the ending . By using this tag, SharePoint always renders the full URL so you don’t have to worry about permissions.
In your custom stylesheet, add the following:
/* Remove div scrolling and let the browser take over */ body.v4master { height: auto !important; overflow: auto !important; width: auto !important; } body #s4-workspace { left: inherit !important; overflow-x: inherit !important; overflow-y: inherit !important; overflow: inherit !important; position: inherit !important; }
That’s it. Here are the results:
![]() |
![]() |
Alternately, you can also use nightandday.master as a starting point for similar results.
(The clients I work with have a mix of team sites, project sites and publishing sites, so v4.master is my starting point of choice for versatility.)
About Author
Comments are closed