Skip to main content

Rounded Corners in SharePoint

Rounded corners have become a staple in website design. But they come with a price. Don't get me wrong I really like the look of them and they really help soften the look of the site.

In most cases you can create this look by using the method below. Later on in this post I will highlight some of the things you can do and some of the things not technically possible without major custom development.

Design 1: Rounded corners to frame a site:

  1. Open up your master page and add 1 <div> tag right before the ms-main table to represent the site container (This is used to position the site and give it its width)
  2. Add 4 more <div> tags before the ms-main table to represent your 4 corners (top left, top right, bottom left, bottom right)
  3. <div id="xyz-content-corner-tl">
    <div id="xyz-content-corner-tr">
    <div id="xyz-content-corner-bl">
    <div id="xyz-content-corner-br">
  4. Add in the following to CSS attributes to represent the 4 corners

#xyz-content-corner-tl{
background-image: url(/_layouts/images/xyz/xyz_content_corner_tl.gif);
background-position:left top;
background-repeat: no-repeat;
background-color: #ffffff;
}
#xyz--content-corner-tr{
background-image: url(/_layouts/images/xyz/xyz_content_corner_tr.gif);
background-position:right top;
background-repeat: no-repeat;
}
#xyz--content-corner-bl{
background-image: url(/_layouts/images/xyz/xyz_content_corner_bl.gif);
background-position:left bottom;
background-repeat: no-repeat;
height: 100%;
}
#xyz--content-corner-br{
background-image: url(/_layouts/images/xyz/xyz_content_corner_br.gif);
background-position:right bottom;
background-repeat: no-repeat;
height: 100%;
}

Example: Please note that the shadow effect is a bit more complex and requires two more <div> tags to represent the right side repeat and the bottom repeat.

image

Design 2: Rounded corners to frame content

  1. This approach can achieved the same way as per above with 4 <div> tags but just needs to included around the <asp:ContentPlaceHolder id="PlaceHolderMain" runat="server"> control within the master page.

Example:

image

Design 3: Rounded corners around individual web parts

  1. Now this one has some tricky elements that I am still trying to work out.
  2. My Original thought was to use the approach above and simply add the 4 <div> tags around each individual webpart zone in a page layout. But there is a catch…
  3. Normally webpart zones are wrapped in a <td> that has an id of "_invisibleIfEmpty" There is some java script that basically hides that zone from rendering on the page if there is no content in it.
  4. However if you place those 4 div tags within that <td> you would assume that it would still hide that zone. But no basically its like a buffer and that JavaScript no longer thinks that zone is empty and it shows it on the page even if there is no webpart in that zone. So you end up with something like below: Notice that below the two web parts on the right there are two empty white containers with nothing in them.

Example:

image

So all in all its fairly easy to add in rounded corners to different areas within your design by using the approach above but there is still a need to have individual web parts with a container all for themselves.

If anyone out there has any ideas on either modifying the JavaScript to ignore the div tags and hide the empty zones or have any other approaches that have worked for them please don't hesitate to comment.

Thanks!

Comments

TK said…
Nice, now if only there was a corners pics gallery somewhere ... :)
Andy Burns said…
Damn, I was going to blog about that sometime soon! I did exactly what you did, and yes, had to do the web part zones, rather than web parts themselves.

Regarding the JavaScript - well, if you're dealing with publishing pages, I reckon it's good to 1) not use the out-of-box ones and 2) build your own.

If you end up doing 2), you can put your own javascript in instead. Personally, I'd be tempted to
- give the innermost div an attribute or name to find it by.
- do a bit of jQuery to find the innermost DIV, then call .parent().parent().parent().hide()

I'll maybe build a demo of that sometime.

Oh, and here were some of my other experiments into rounded corners...
Marcy Kellar said…
Erik, again, your expertise and experience really helps validate my direction.

We were using jquery for custom navigation and tried to use a plugin for rounded corners but found the stacking to be too troublesome. In fact, just today, I am revising our master page to include this method to create rounded corners in a custom design.


I hope we meet at SPC 2009 in Vegas. Are you speaking?
d3vlabs said…
when you are reffering to master page, can you specify exactly what file. im using wss 3.0 and have fubared my sharepoint installation once by editing the wrong master page. Thank you.
Does your solution scale based on screen resolution?
maxnmaria said…
This comment has been removed by the author.
maxnmaria said…
I apply the divs and CSS styles on frame content master page. The issues are it doesn't show the corners when you on edit page and othe system page i.e shared documents.It only display it properly on Home Page.

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