0

Can we hide below from modern UI pages using css?

odern

2 Answers 2

1

For your requirement you need to use the custom css on the Modern page (Not good practice though).

Try using below CSS:

<style>
    div.commandBarWrapper {
        display: none !important;
    }
</style>

To add this code you will need a script editor web part. Below is the Modern Script Editor web-part created using SPFx:

Modern Script Editor web-part.

4
  • Try this and let me know if this works for you. I can provide you the SPFx package(.sppkg) file of modern script editor if you need. Sep 23, 2019 at 15:17
  • 1
    Thank let me check if required i will ask for spfx package
    – kumar
    Sep 23, 2019 at 17:06
  • it worked for me i set it global thank you
    – kumar
    Sep 24, 2019 at 3:33
  • Welcome. Glad it worked for you. Sep 24, 2019 at 3:58
1

If you want to hide the page title and command bar for all the modern page, we can create an application customizer to inject the CSS style below to achieve it.

div[class^='pageTitle_']{
    display: none !important;
}
div.commandBarWrapper {
    display: none !important;
}

Source code: SPFx Applications Customiser CSS Injection

Your Answer

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

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