How can we help you today?

How to Add a Background Image to the SharePoint Page Header

By default, your SharePoint header has a basic design:


default header design


This article will demonstrate how to add a background image to the Header of your SharePoint page using the ShortPoint Code Editor Web Part: 


SharePoint Header with background image


TABLE OF CONTENTS


Prerequisite


Quick Walkthrough

1. Copy the code below and replace the background-image URL value with the  background image URL you want to use:


shortpoint.$('[class*=headerRow-]').css({  'background-image': 'url(https://yourimageurl.jpeg)',  'background-position': 'center',  'background-size': 'cover'});

2. Go to your SharePoint page and add the ShortPoint Code Web Part.

3. Click the Edit Properties icon of the ShortPoint Code to edit it.

4. Paste the copied code in the JavaScript field, customize it to your needs, and click Save.

5. Close the ShortPoint Code window.

6. Republish the page.


Step-by-step Tutorial

Go through the steps to learn how to add a background image to your SharePoint Header. We will be using a JavaScript Code to accomplish this.


Step 1: Copy the JavaScript Code

Copy the JavaScript code below:


shortpoint.$('[class*=headerRow-]').css({  'background-image': 'url(https://yourimageurl.jpeg)',  'background-position': 'center',  'background-size': 'cover'});

Replace the background-image URL value with the background Image URL you want to use. See the example below for your reference:


shortpoint.$('[class*=headerRow-]').css({ 'background-image': 'url(https://shortpoint-templates.s3.us-west-2.amazonaws.com/Airlines-1/airlines_1_6.jpeg)', 'background-position': 'center', 'background-size': 'cover'});

Step 2: Add the ShortPoint Code Web Part

Go to the SharePoint page where you want to add a Header Background and click Edit:

Edit


Click the close icon to leave the Toolbox:

close icon


Select the plus icon to add a web part:

plus icon


Use the search bar to look for ShortPoint Code, or scroll down until you see the Advanced section. Click ShortPoint Code:

ShortPoint code


Step 3: Edit the ShortPoint Code Web Part

Click the Edit Properties icon:

Edit properties icon


Step 4: Paste the Code

Click the Edit JavaScript field:

Edit JavaScript field


Paste the code in the space provided:

Paste code


You can directly edit the code in the code editor. Freely customize the code according to your needs and click Save:

customizing code


NOTEMake sure that Sandbox Mode is disabled. Otherwise, the JavaScript code will not be applied properly.

Step 5: Delete Default Codes

Delete default codes inside the Edit HTML field and Edit CSS field:

delete default codes


Step 6: Republish Page

Once satisfied, click the close icon to leave the ShortPoint Code window:


close icon


Click Republish once you’re ready to make your changes live:

Republish


Congratulations! You've successfully added a background image to your SharePoint Header:

header with background image


 We listed below more ways to use the ShortPoint Code Editor. Check them out now!

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.

World's best intranet sites are designed using ShortPoint

Get started today! Learn more
See all 18 topics

Start a trial

Ignite your vision. Install ShortPoint directly on your site, or play in sandbox mode. No credit card required.

Get started today

World’s best intranet sites are designed using ShortPoint

Thousands of companies using ShortPoint everyday to design, brand and build award winning intranet sites.

Get started Learn more