Modifying css

%3CLINGO-SUB%20id%3D%22lingo-sub-2208272%22%20slang%3D%22en-US%22%3EModifying%20css%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2208272%22%20slang%3D%22en-US%22%3E%3CP%3EI've%20seen%20a%20few%20online%20posts%20where%20it%20was%20suggested%20to%20modify%20a%20sharepoint%20site%20css%20to%20solve%20a%20specific%20problem%20(eg.%20hiding%20the%20cog%20icon%20to%20prevent%20users%20from%20accessing%20the%20site%20content%2Fusage).%20I'm%20an%20admin%20of%20a%20sharepoint%20site%20but%20am%20not%20sure%20where%20I'd%20enter%20the%20css%20to%20do%20it.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOn%20a%20site%20note%2C%20I%20still%20can't%20believe%20that%20there%20seems%20no%20clean%20way%20of%20preventing%20users%20from%20seeing%20the%20site%20content%20option%20under%20the%20cog%20icon%20menu.%20The%20fact%20that%20everyone%20seems%20to%20be%20able%20to%20access%20the%20recycle%20bin%20content%20for%20all%20users%20is%20a%20weird%20solution%2C%20IMHO.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2208272%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESharePoint%20Online%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2209276%22%20slang%3D%22en-US%22%3ERe%3A%20Modifying%20css%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2209276%22%20slang%3D%22en-US%22%3ETo%20my%20knowledge%2C%20there%20is%20no%20%22approved%22%20way%20to%20currently%20do%20this%20on%20modern%20pages.%20SPFx%20has%20some%20options%2C%20but%20if%20you%20modify%20the%20page%20DOM%20outside%20of%20your%20web%20part%20or%20extension%2C%20you%20do%20so%20at%20your%20own%20risk.%20Twice%20in%20the%20past%206%20months%2C%20Microsoft%20has%20made%20changes%20to%20the%20modern%20page%20CSS%20classes%20that%20have%20%22broken%22%20people's%20efforts%20to%20manage%20CSS%20that%20they%20don't%20own.%20To%20quote%20Andrew%20Connell%20(%40andrewconnell)%2C%20%22The%20DOM%20is%20not%20an%20API%22%20which%20just%20means%20Microsoft%20is%20not%20obligated%20to%20keep%20the%20DOM%20the%20same%2C%20or%20notify%20you%20that%20is%20has%20changed.%3CBR%20%2F%3E%3CBR%20%2F%3EThat%20said%2C%20the%20next%20version%20of%20SPFx%20(v1.12)%20is%20supposed%20to%20give%20developers%20additional%20access%20to%20the%20page%20DOM.%20I%20have%20not%20seen%20details%20yet%20on%20what%20areas%20will%20be%20available.%3CBR%20%2F%3E%3CBR%20%2F%3EAs%20far%20as%20your%20final%20note%2C%20I%20recommend%20searching%20UserVoice%20and%20adding%20your%20vote%20any%20requests%20that%20are%20already%20there%20or%20start%20a%20new%20request.%20%3CA%20href%3D%22https%3A%2F%2Fsharepoint.uservoice.com%2Fforums%2F329214-sites-and-collaboration%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fsharepoint.uservoice.com%2Fforums%2F329214-sites-and-collaboration%3C%2FA%3E%3CBR%20%2F%3EI%20found%20this%20item%3A%20%3CA%20href%3D%22https%3A%2F%2Fsharepoint.uservoice.com%2Fforums%2F329214-sites-and-collaboration%2Fsuggestions%2F18486868-hide-site-contents-access-links%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fsharepoint.uservoice.com%2Fforums%2F329214-sites-and-collaboration%2Fsuggestions%2F18486868-hide-site-contents-access-links%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3EI%20hope%20this%20helps.%20If%20so%2C%20please%20mark%20this%20as%20an%20answer.%3C%2FLINGO-BODY%3E
Occasional 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.