3

I'd like to hide the header on my homepage (the <h1 id="pageContentTitle" .. > element.) I could use some CSS like

#pageContentTitle{ display:none; }

But because my CSS is referenced in the master file, this effects all pages on my site, where I would like to only change one.

I've also considered using some jQuery:

$('#pageContentTitle').filter(function(){
    return $(this).find('a:contains(Home)').length;
}).remove();

Which works, but has issues. Firstly the header is displayed momentarily until the JavaScript is executed, secondly this still needs to run on every page which seems like overkill.

I would have thought this would be quite a common desire so was hoping to find an option in the Page Settings but couldn't find anything yet.

Is there a better way of doing this?

4 Answers 4

4

Add the following CSS and reference it from your masterpage:

<style>

#aspnetForm[action*="Home.aspx"] #pageContentTitle {display:none;}

</style>
1
  • Brilliant, the form scope is what I needed. Thanks.
    – user11745
    Aug 28, 2014 at 15:05
3

You can easily add a content editor webpart and add in your CSS in the HTML editor.

Or you can add your CSS to a text file, then using a content editor webpart, you can reference that text file and it will include the css in that page.

4
  • I've tried your suggestion, and it works, but since the content editor webpart is presumably loaded after the page load, my title still shows up momentarily before being hidden.
    – user11745
    Aug 28, 2014 at 14:36
  • It is inevitably going to show for a split second before the css hides it.
    – etm124
    Aug 28, 2014 at 14:43
  • Sure, because the CSS is dynamically loaded. I thought there may well be an option provided by sharepoint so as to not include the header altogether. I guess not.
    – user11745
    Aug 28, 2014 at 14:47
  • When I try this SPO removes the css code from my content editor.
    – bgmCoder
    Feb 1, 2017 at 23:41
0

you can edit the page directly using sharepoint designer, then add your snippet of code directly, it will break the page definition... but that normally isn't a big deal.

3
  • I did try that yes, but like you said I got complaints about the page definition. Should I not worry about this warning?
    – user11745
    Aug 28, 2014 at 14:54
  • Nope you should be good!
    – etm124
    Aug 28, 2014 at 14:55
  • How do you get rid of the banner The Current page has been customized from its template. Revert to Template that shows on the customized page?
    – bgmCoder
    Feb 1, 2017 at 23:50
-1

You could edit the page in SharePoint Designer, and add the CSS to the page.

1
  • 1
    You need to add more detail about how to do it.
    – Waqas Sarwar MVP
    Aug 28, 2014 at 15:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.