Skip to main content

SharePoint 2010 Chrome Type CSS Classes

For content authors the ability to stylize web parts with just a few simple clicks is a big win. In some cases you might want to emphasize a web part on the page and make it stand out. There are basically 4 main web part styles/chrome that you can apply to any webpart.

You will notice below that the chrome type “None” and “Title Only” do not have a unique class name so they will share the same style. The “None” style simply does not show the web part title.

Chrome (None):
.ms-WPBody{
font-size:8pt;
font-family:verdana,arial,helvetica,sans-serif;
}
image

Chrome (Title Only):
.ms-WPBody{
font-size:8pt;
font-family:verdana,arial,helvetica,sans-serif;
}
image

Chrome (Title and Border):
.ms-WPBorder, .ms-WPBorderBorderOnly{
border-color:#9ac6ff;
border-width:1px;
border-style:solid;
}
image

Chrome (Border Only):
.ms-WPBorder, .ms-WPBorderBorderOnly{
border-color:#9ac6ff;
border-width:1px;
border-style:solid;
}
image

Since Title and Border and Border Only have their own unique classes you can apply custom styles properties and make them unique.

The next step is to learn how to apply these types of chrome types. First simply edit the page, click on the web part title arrow, and choose “Edit Web Part”.

image

Second, a panel will appear on the right side, click on the plus icon next to “Appearance”. From here you will be able to change the web part title and the chrome type.

image

Once you have chosen the Chrome Type simply click on the “OK” button and then save'/publish the page.

This is where the real fun begins. Now that you know how to apply the Chrome Type and you also have the class name for each one, you can easily create some really interesting styles for you web parts.

Example 1: (Title only/None with changes to the font)
.ms-WPBody{
font-size:14px;
font-family: Arial, sans-serif;
line-height: 20px;
letter-spacing: -.2px;
}

image


Example 2: (Title and Border with additional padding for text also includes custom border style and update web part title) 
.ms-WPTitle{
font-weight:bold;
font-family: Arial, sans-serif;
font-size:16px;
color: #C00;
}
.ms-WPBorder{
border: 3px #C00 dashed;
background-color: #EEE;
}
.ms-WPBorder .ms-WPBody{
padding: 10px;
font-size:12px;
color: #000;
line-height: normal;
letter-spacing: 0px;
}
image


Example 3: (Border only with custom border color and background image)
.ms-WPBorderBorderOnly{
border: 2px #7ea0dd solid;
background-image:url("/_layouts/images/MYSITEBG.GIF");
background-position:top left;
background-repeat:repeat-x;
}
.ms-WPBorderBorderOnly .ms-WPBody{
padding: 10px;
font-size:14px;
font-weight:bold;
color: #000;
line-height: normal;
letter-spacing: 0px;
}
image

Comments

chasepes said…
Hi Erik:
Thanks for detailed rundown. Valuable stuff.

I understand CSS changes in SP2010 pose difficulties compared to 2007, but might you post an article on List CSS info?

Thanks-

Charlie
Erik Swenson said…
Casepes,
Can you provide more detail on what you mean by "List CSS Info"? I will see what I can pull together once I get a better understanding of the topic.
Magnus Hansson said…
About Branding and developing Interface for Customers in SharePoint: http://maghansson.blogspot.com/2012/01/developing-sharepoint-interface.html
What do you think about the seperation of Presenation and the actual Branding ?
Anonymous said…
Hi Erik,
By list CSS I mean all the possible CSS one could make to a default style list view.

Specifically, I'd like to put hairline borders around the .ms-Vh's and vh2.

Thanks
Charlie
ipad poker said…
Very nice post. I like your blogging techniques and have bookmarked this blog as found it very informative. Keep it up.
Unknown said…
Nice - but now the question as a content author (SPD not available to use in corp environment nor access to modify the master page) How would one apply this to just one web part in a page, rather than all web parts?
Colin said…
This has really helped me a lot. Thanks for making it available/

Popular posts from this blog

How To: Create Hyperlink to Modal Pop-Up Form

I was asked by a client recently if there was a way to create a hyperlink to a New Item Form anywhere within a site but still get the rich experience of the Modal pop-up window that grays out the background. (Note this is for SharePoint 2010 Only…) I basically took the code directly from the “Add new item” and the “Add Document” link within the list view. What this allows you to do is simply add in the following code to any content editor web part, Master page, or Page Layout in any site collection and display the form to be filled out. The user will get the nice experience of the modal window and not have to navigate away from their current page. This could be used for example a feedback form that is included in the master page so whenever someone wants to give feedback it is always going back to a central list. The only that is required for you to know is the List ID and the site name. Full Code For a List Item: <a onclick="javascript:NewItem2(event, &quot

SharePoint 2010 Base CSS Classes

This will be the first of many SharePoint 2010 posts. I will be focusing on a few of the main CSS classes used for SharePoint 2010 Public Beta. As the product becomes more final there might be some changes to the class names but I will be sure to create a new post if that happens. This will be quite a lengthy but it should be helpful. The default CSS given below are just highlights of the full CSS attributes for that class. I will be using a basic team site as my base for the screenshots. Here is a basic structure of the main areas that I will cover. Ribbon Row Table Row Left Site Actions Navigate Up Edit Tab List Browse Page Table Row Right Give Feedback Welcome Menu Workspace Body Container Title Row Title

SharePoint 2013 Responsive Table Columns

I have been wanting to write this one for a while now. It is really amazing how UX is really finding is way into everything that we use and interact with. From Custom applications both mobile and on a desktop to document management or large data visualizations. There is always room for better usability and new concepts. SharePoint lists and library functionality really has not changed much for the past 10 years... I remember back in 2003 when I saw the same table/grid based views of documents and list items that exists in SharePoint 2013. But now we can look at them in a whole new way! In this video blog you will see how to create a responsive CSS table so that when the browser size is reduced it will hide specific columns. However hiding data is not always the right thing to do. What if a user needed those columns to filter on or to use for comparison to another document? Well that is where the custom jQuery Column chooser comes in. It allows you to see what columns are displ