SharePoint Styling

Excuse the absence blog lovers, I have been busy setting up my own consultancy, working through my masters and preparing for another more tougher obstacle mud run, and enjoying the warmer weather.

 

Recently I have been trying to get a background image to display on a content area wiki page in SharePoint 2010, so without making changes to the master page I used a Content Editor Web Part, and pointed it to a text file in my Site Assets.

 

Using F12 I managed to find the exact element to style: .ms-rte-layoutszone-inner being the new plaything produced some of this magic:

.ms-rte-layoutszone-inner {
BACKGROUND-IMAGE: url(http://yoursite/SiteAssets/Images/background.jpg);

But the image didn’t scale well. Adding this displayed the whole image on the required area only on Chrome and Firefox:


background-size: 100% 100%;

The above CSS doesn’t work for me in Any Internet Explorer, even though research points to its support for browsers after 9, and mine is IE11.  (Blast you Microsoft!)

 

I did find a workaround though, adding some of this to the potion:

 

background-size: cover; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader( src=’http://yoursite/SiteAssets/Images/background.jpg’,
sizingMethod=’scale’);
This uses a filter to scale the image to fit in the required area, and gets IE to behave like the other browsers.

That’s all, over and out.

Advertisements

Free Books

Another large collection of Free Microsoft eBooks and Resource Kits for you, including: SharePoint 2013, Office 2013, Office 365, Duet 2.0, Azure, Cloud, Windows Phone, Lync, Dynamics CRM, and more….

 Freebies:

 

http://blogs.msdn.com/b/mssmallbiz/archive/2012/07/30/another-large-collection-of-free-microsoft-ebooks-and-resource-kits-for-you-including-sharepoint-2013-office-2013-office-365-duet-2-0-azure-cloud-windows-phone-lync-dynamics-crm-and-more.aspx

Web Part Zones In Master Pages??

So can you put Web Part Zones in Master Pages, or what?

A customer wants to put a web part zone below the quick nav in their SharePoint site – not an unusual request. Naturally, I cracked open SharePoint Designer, and tried adding a web part zone – and this is what I got:

I tried to understand why this would be the case, but quite simple, couldn’t. Naturally, I then referred to the documentation (!) on MSDN. It had mentioned this at the bottom of the page.

You cannot add Web Parts in zones to a master page. You can add static Web Parts (parts outside of a zone) to a master page, but you cannot add dynamic Web Parts to master pages.

Okay, that seems clear enough – I get why you could add static web parts to a master page, but not dynamic – but what about the web part zones themselves?

You can add zones to master pages and later add Web Parts to the zone in the browser, but the Web Parts are associated with the content page.

Yup, that seems fair enough. I get that in theory. So why in practice does SharePoint Designer say I can’t?

I began looking around to see if others had tried this – and found interesting contradictions. Mirjam says you can’t – but does point out that you can override the standard quick nav in your page layout, and put a web part zone into that. Microsoft SharePoint Step by Step seems to say the same thing. Yet ASP.NET would support this just fine, and as noted the MSDN docs say it should work.

Okay, one thing left to do – actually try it. SharePoint Designer won’t let me add the web part zone by ‘drag and drop’, but I can code one by hand:

And it renders in SharePoint Designer:

But when you try and use the page:

Well, I ain’t going to argue with a parser error – it looks like you really can’t do this, despite the MSDN docs.