Modifying css

Copper Contributor

I've seen a few online posts where it was suggested to modify a sharepoint site css to solve a specific problem (eg. hiding the cog icon to prevent users from accessing the site content/usage). I'm an admin of a sharepoint site but am not sure where I'd enter the css to do it.

 

 

On a site note, I still can't believe that there seems no clean way of preventing users from seeing the site content option under the cog icon menu. The fact that everyone seems to be able to access the recycle bin content for all users is a weird solution, IMHO.

 

Thank you

1 Reply
To my knowledge, there is no "approved" way to currently do this on modern pages. SPFx has some options, but if you modify the page DOM outside of your web part or extension, you do so at your own risk. Twice in the past 6 months, Microsoft has made changes to the modern page CSS classes that have "broken" people's efforts to manage CSS that they don't own. To quote Andrew Connell (@andrewconnell), "The DOM is not an API" which just means Microsoft is not obligated to keep the DOM the same, or notify you that is has changed.

That said, the next version of SPFx (v1.12) is supposed to give developers additional access to the page DOM. I have not seen details yet on what areas will be available.

As far as your final note, I recommend searching UserVoice and adding your vote any requests that are already there or start a new request. https://sharepoint.uservoice.com/forums/329214-sites-and-collaboration
I found this item: https://sharepoint.uservoice.com/forums/329214-sites-and-collaboration/suggestions/18486868-hide-sit...

I hope this helps. If so, please mark this as an answer.