Forum Discussion
Any way to tighten up spacing between web parts?
I need to insert two images side-by-side with text above and below them. The only way I can see to do this is to have the web parts in separate sections, which adds a lot of white space between everything. I've blurred out the text, but you can see what I mean below, along with the layout I'm using. Is there any way to tighten up the spacing between sections? There appear to be no options.
This is SharePoint Online, BTW.
As RobElliott mentioned, there is no out of the box way to inject custom CSS on SharePoint online modern pages.
However, you can use SharePoint framework (SPFx) for injecting custom CSS/JS on modern pages.
- For particular site pages - use Modern script editor web part
- For all pages in sites - use SPFx application customizer
Check my answers given on these threads:
- How can I include the same JS and CSS files on multiple SharePoint Modern Page?
- Insert script in the header of the Modern page- SharePoint Online
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
4 Replies
Ukiman1014 Unfortunately, there is no SharePoint out of the box way to reduce these spacings between web parts or sections in SharePoint online modern experience.
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
- Ukiman1014Brass ContributorThanks. With SharePoint Online, is there a way to use CSS to alter the way certain pages display? I understand this is not supported or recommended, but I have always been unsure if it it was possible with SPO.
As RobElliott mentioned, there is no out of the box way to inject custom CSS on SharePoint online modern pages.
However, you can use SharePoint framework (SPFx) for injecting custom CSS/JS on modern pages.
- For particular site pages - use Modern script editor web part
- For all pages in sites - use SPFx application customizer
Check my answers given on these threads:
- How can I include the same JS and CSS files on multiple SharePoint Modern Page?
- Insert script in the header of the Modern page- SharePoint Online
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.