How can we help you today?

How to Hide Elements on Your SharePoint Page

With the help of the ShortPoint Code Editor web part, you can hide any element on your page. For example, we’ve hidden the highlighted navigation menu below using Custom CSS:


navigation menu


After pasting the Custom CSS in the SShortPoint Code Editor web part, this will be the result:


result


This article will demonstrate how to hide any element on your page using the ShortPoint Code Editor web part. Follow the quick walkthrough or the detailed steps to get started.


Quick Walkthrough

1. Inspect the element you want to hide and identify the parent and child selectors.

2. Copy the code below and replace the parent and child selectors with the one you found:


[class*="parentselector"] [class*="childselector"] { display: none !important; }


3. Insert the ShortPoint Code web part.

4. Edit the web part and delete default codes.

5. Paste the code you worked on in step 2 in the Edit CSS field.

6. Close the ShortPoint Code window.

7. Make sure that Sandbox Mode and Contain CSS Styles are disabled.

8. Publish the page.


TABLE OF CONTENTS


Prerequisites


Step-by-step Tutorial

The steps are divided into two parts. Follow each part carefully to successfully hide elements on your page: 


Part 1: Get the Parent and Child Selector

This part will teach you how to get the parent and child selector.


Step 1: Copy the Code

  • Copy the code below and paste it into a notepad:
[class*="parentselector"] [class*="childselector"] { display: none !important; }

Step 2: Inspect Element

  • Go to the SharePoint page you want to use and identify the element you want to hide. For this guide, we want to hide the highlighted navigation menu:


navigation menu


  • Right-click on the element and select Inspect


Inspect


  • The dev tools window for your page will open:


dev tools window


Step 3: Find the Parent Selector

  • As you hover over different lines of code in the dev tools window, you'll notice certain areas of your SharePoint page highlighted in blue. This simply means that the highlighted area corresponds to the line of code you are hovering over in the dev tools window. 


dev tools window highlights


  • You need to go through the line of codes until you reach the whole area where the elements you want to hide are contained. For example, since we want to hide the navigation menu, we need to look for the line of code that covers the whole area of the navigation menu, including the logo and the title of the page. This will be our parent selector:


whole container of navigation menu


  • Once you find it in the dev tools window, you need to copy the line of code that comes after class=”


copy


  • Then, go back to the code you copied in Step 1 and replace parentselector. Your code will now look like this:
[class*="root-103"] [class*="childselector"] { display: none !important; }
  • To ensure that the code works properly, remove the number that comes after “-”. Your code will now look like this:
[class*="root-"] [class*="childselector"] { display: none !important; }

Step 4: Find the Child Selector

  • Now, you need to find the line of code that contains only the elements you want to hide. This will be the child selector. Meaning, in our example, the blue highlight should only be on the navigation menu  and nowhere else:


navigation menu


  • Once you find it in the dev tools window, you need to copy the line of code that comes after class=”


copy


  • Then, go back to the code you are working on and replace childselector. Your code will now look like this:
[class*="root-"] [class*="bottomNavRow-107"] { display: none !important; }
  • To ensure that the code works properly, remove the number that comes after “-”. Your code will now look like this:
[class*="root-"] [class*="bottomNavRow-"] { display: none !important; }
  • Take note of the code you worked on. You will need it in Part 2.

Part 2: Hide Elements

This part will show you how to hide the elements:


Step 1: Insert the ShortPoint Code Editor

  • Edit your SharePoint page:


Edit


  • Close the Toolbox:


close icon


  • Click the plus icon to add web parts:


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 2: Edit the ShortPoint Code

  • Click the Edit properties icon:


Edit properties icon


Step 3: Delete Default Codes

  • Go through each field, delete the default codes, and save:


delete default codes


Step 4: Paste the code

  • Click the Edit CSS field:


Edit CSS field


  • Paste the code you prepared in Part 1 and Save:


paste and save


  • To ensure that the code works properly, scroll down and make sure that Sandbox Mode and Contain CSS Styles are disabled:


disable Sandbox Mode and Contain CSS Styles


Step 5: Publish

  • Close the ShortPoint Code window:


close icon


  • Publish your page:


Publish


Congratulations! You have successfully hidden the selected elements on your page:


result


Related articles:








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 27 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