We have included PowerBI webpart on sharepoint site page. All reports are displaying currectly.

But we have lot of white space around the reports. We need to add some css to the page. Is it possible to add customized code to sitepages?

Please help.

Thanks in advance.

2 Answers 2


What you mentioned should be Modern Site Pageenter image description here.

There is a react-script-editor SPFx webpart, after you deployed this webpart to your tenant, you could add custom CSS/js to modern page which works like script editor webpart in classic page.


You mentioned "publishing pages", but you also mention using the power bi part. "Publishing pages" references a feature in "classic" mode, where we have a large degree of control over the html/css. Instructions for this are well documented, and have not changed in years. But, the fact that you're using the power bi part and are complaining about whitespace suggests that you're dealing with a sharepoint page in "modern" mode. Modern pages do not have any OOB customization options for modifying the HTML/CSS. The usual answer is that if you do not like a particular web part, then build your own using Visual Studio Code and SPFx (I know, not a feel-good answer for most).

You can find blog posts that explain how to create custom extensions that then allow you to inject css, but the standard warning applies: any changes you make via these mechanisms are outside of the recommended options, and if MS changes their master pages, your solution could break.

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.