fixed width design in SharePoint 2010
Categories:CSS; SharePoint Designer; Site Manager/Power User; MOSS;
WSS; 2007; 2010
There are a lot of fixed width
master page solutions available on the internet and I've read most of them.
Some require JavaScript or don’t respect the ribbon, which means that the
ribbon will be placed inside the fixed width design.
There are a lot of fixed width
master page solutions available on the internet and I've read most of them.
Some require JavaScript or don’t respect the ribbon, which means that the
ribbon will be placed inside the fixed width design. SharePoint is smart enough
to handle small screen resolutions by compacting and rearranging the icons in
the ribbon, but if a larger screen is used it gets really hard to administer
SharePoint and breaks the usability completely.
There is a much quicker and safer
way to create a flexible master page where only certain CSS properties need to
be changed to get any fixed width design as well as centered design with a
border to the left and right.
Reasons
for a centered design
There are certain reasons for a
centered or fixed width design. By default SharePoint scales the complete page
to 100% of the screen. When it comes to web content management the design is
more text driven and collaboration concerns are not that relevant. When the
content gets wider and wider with the screen resolution the lines of text get
longer and longer. The content then will be harder to read.
Fixed width looks pretty but
generally only makes sense when public facing web sites should be created. The
reason is that you don’t know what the users screen resolution is. Nowadays the
most common design requires supporting a minimal resolution 1024px or maybe
sometimes 1280px. To be on the safe side most web designer's use grid systems
like 960.gs
which implements widths of 980px and is optimized for a minimal screen
resolution for 1024 by 786.
Fixed design could also be used for
blogs and maybe wikis. From a collaboration perspective a 100% width makes more
sense. So comment and let me know if you think differently.
Centered
Design in SharePoint
As I said before most of the
tutorials available on the web don’t respect the ribbon and stuff it into a
design that has a fixed width. The fastest way to get a fixed width design I
found needs only the following CSS code and is flexible to be changed to any
desired width.
div.s4-title.s4-lp,
|
|
body #s4-mainarea,
|
#s4-topheader2,
|
||
#s4-statusbarcontainer {
|
width: 960px;
|
|
margin: auto;
|
padding: 0px;
|
||
float: none;
|
background-image: none;
|
||
background-color: white;
|
}
|
To get the fixed width design
working with the v4.master some classes needs to be added.
1
|
<div id="s4-workspace">
|
Needs to be changed to:
1
|
<div id="s4-workspace" class="s4-nosetwidth">
|
And the second html element needs to
be altered:
1
|
<div id="s4-titlerow" class="s4-pr s4-notdlg
s4-titlerowhidetitle">
|
This need to be changed to:
1
|
<div id="s4-titlerow" class="s4-pr s4-notdlg
s4-titlerowhidetitle s4-nosetwidth">
|
By adding the s4-nosetwidth style
class SharePoint won’t assign the inline style property for width and the
design will stay centered. The result looks like this:
960px fixed width design
fixed width with ribbon enabled
At the end the design of SharePoint
is centered. When any page is edited the Ribbon will remain on the whole width
of the browser. It’s much more comfortable to edit SharePoint that way.
The size of the design could be
changed to any size just by simply modifying the width property. Remember
always respect the size of the ribbon and let it live outside your design for
easy editing.
Custom Master Page Design:
body #s4-mainarea,
#s4-topheader2,
#s4-statusbarcontainer {
width: 1024px!important;
margin: auto;
padding: 0px;
float: none;
}
.ms-dialog #s4-mainarea, .ms-dlgFrame #s4-mainarea {
width:auto!important;
}
.ms-dialog .content-wrapper
{
background:none;
}
.ms-dialog {
overflow:auto;
}
div #s4-titlerow {
width: 1024px!important;
margin: auto;
padding: 0px;
float: none;
background-color: white;
}
Custom Master Page Design:
body #s4-mainarea,
#s4-topheader2,
#s4-statusbarcontainer {
width: 1024px!important;
margin: auto;
padding: 0px;
float: none;
}
.ms-dialog #s4-mainarea, .ms-dlgFrame #s4-mainarea {
width:auto!important;
}
.ms-dialog .content-wrapper
{
background:none;
}
.ms-dialog {
overflow:auto;
}
div #s4-titlerow {
width: 1024px!important;
margin: auto;
padding: 0px;
float: none;
background-color: white;
}
No comments:
Post a Comment