0

We have a classic online team site where we added a new modern page to it, and we set the modern page as the home page of the site. something as follow-

enter image description here

But currently we have, 2 wasted horizontal spaces (I highlighted them in red arrows inside my above picture) , as follow:-

  1. the area where the logo and the site title is being rendered.

  2. the home page banner image (containing the desert image).

so are there any approaches (built-in or using coding) , that can allow us to minimize the height of these 2 components or at-least one of them?

1 Answer 1

1

We can download and deploy the react script editor web part to your site, and add react script editor web part to the modern page, then add the CSS style below into this web part to adjust the spaces.

<style>
div[class^='mainRow-']{
    height:50px !important;
}
div[class^='pageTitle_'] div[class*='backgroundImage_']{
    height:80px !important;
}
</style>

Source code of the react script editor web part: react-script-editor

Article reference: Add The Script Editor Webpart back to SharePoint Modern Experience

5
  • so in this case i have to add the react script editor to every modern page?
    – John John
    Commented Dec 18, 2018 at 11:22
  • Yes, we can use PnP PowerShell(Add-PnPClientSideWebPart command) to add web part to modern page. linkedin.com/pulse/…
    – LZ_MSFT
    Commented Dec 19, 2018 at 1:14
  • so you mean i will run a PnP script to add webparts to all the modern pages? and if i add new modern pages then i will have to run the PnP script again and again?
    – John John
    Commented Dec 19, 2018 at 2:52
  • 1
    Loop all the modern pages in the code and add web parts to all the modern pages. And create a job run it automatically.
    – LZ_MSFT
    Commented Dec 19, 2018 at 3:02
  • ok i got your point,, now this will work on paper but do you think i need to take this path?
    – John John
    Commented Dec 19, 2018 at 11:17

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.