SharePoint: I didn’t know you could do that with CSS!


You may also be interested in: Documentation Toolkit for SharePoint


 

Editor’s note: Contributor Benjamin Niaulin is a SharePoint Specialist at Sharegate. Follow him @bniaulin

Not long ago, I started a branding series to get closer to how I could change the look and feel of my SharePoint site without dealing with tons of complicated code stuff. So I looked at the basic elements of a SharePoint site, mainly the navigation, and with CSS I discovered a whole world of possibilities. In time, I even pushed on to realize jQuery did not have to be a scary word only developer’s use. You can find links to my series here.

I decided to start a series that will show you some cool little tricks you can do with CSS. If you are not sure how to apply CSS, go back to the first articles of my series above where it is described in details. In short, you can use the Content Editor Web Part to a CSS that will apply to a single page. The one with the CEWP on it.

Hide the Quicklaunch

We all love the quicklaunch, navigation menu on the left.

2013-04-29-DidntKnowCSSSharePoint-01.png

But there are times when you would rather maximize the page content and leave the quicklaunch out of it.

2013-04-29-DidntKnowCSSSharePoint-02.png

The solution is but a few lines of CSS:


<STYLE>
#s4-leftpanel {
    display: none
}
.s4-ca {
    margin-left: 0px
}
</STYLE>

The code above hides the “left panel” (quicklaunch) and gives the “Content Area” (.s4-ca) full width by starting from 0px on the left.

Hiding the “Recently Modified” of wikis

2013-04-29-DidntKnowCSSSharePoint-03.png

Probably the most popular demand I get during sessions or at conferences.

This will do the trick:


<STYLE>
.s4-recentchanges{
     display:none;
}
</STYLE>

SharePoint uses a class called s4-recentchanges to show it

Hiding “I Like it and Tags and Notes”

I do get this request from time to time. Although I don’t always agree as it adds a great value to the end user on SharePoint and My Profile.

2013-04-29-DidntKnowCSSSharePoint-04.png


<STYLE>
.ms-socialNotif-Container {
     display:none;
}
</STYLE>

And it’s gone

Change the look of hyperlinks with specific words in the link

Let’s say you want to add an icon for every link to “My Sites” in your SharePoint. Or simply change the font and color of links to the company web site.

2013-04-29-DidntKnowCSSSharePoint-05.png

In this example, I want to change the color of the link to the Sharegate site to orange and make it bold. But I don’t want to do this only to this hyperlink, that would be easy. I want CSS to always find the links wherever they are and change it automatically


<STYLE>
A[href*='share-gate'] {
    COLOR: #e36c09; 
        FONT-WEIGHT: bold
}
</STYLE>

2013-04-29-DidntKnowCSSSharePoint-06.png

Stay in touch via twitter @bniaulin

For everything SharePoint and Office 365 from the community for the community!