Skip to main content

Cloud

Simple fixes for un-preferable behavior with wide content in SharePoint 2010 (v4.master)

Overview:

A complaint about SharePoint 2007 sites is that they use TABLES for layout. TABLES make the UI less accessible, flexible, and functional – to put it simply. SharePoint 2010 was developed with todays standards of compatibility and uses DIVs and SPANs instead. Mostly this works well but I will point out an area where this causes poor behavior.

Specifics:

When using an out-of-the-box SharePoint 2010 master page, like v4.master, you will see un-preferable behavior when the content in the page is wider than the browser window. The image below (1.) shows that when you scroll right to view wide-content the Title-Row (s4-titlerow) stops and does not does not stretch to to the end of the page. This especially looks bad when you have chosen a page background color. Those who have changed the page background from white will know what I mean.
(1.)
Title row stops before the end of the page
 

The fix for all browsers:

Put a TABLE between the s4-workspave DIV and the s4-bodyContainer DIV like this:

  <div id="s4-workspace">
     <table cellspacing="0" cellpadding="0"><tr><td>
           <div id="s4-bodyContainer">

Once you have done that the Title Row grows to meet the end of the page.
(2.)
Title row grows to meet the end of the page
 

The fix for newer browsers

If you do not need this fixed in older browsers such as IE 7, Safari 3, Chrome 1 then there is an easier, more standards compliant fix.
In CSS, add “display:table” to the element on the page with id of “s4-workspace” like this:

  #s4-workspace {display: table}

This causes the element to act like a TABLE and expand to the width of its content.
To read more abut the display declaration and how browsers use it:
http://www.quirksmode.org/css/display.html

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Seth Broweleit

More from this Author

Follow Us