Can we add CSS to SharePoint Group Site Template

Krishna Sandeep Sangani 61 Reputation points
2020-12-08T04:27:44.573+00:00

Hi ,
We have a SharePoint Online site with Template GROUP#0 i.e. Office 365 Group associated Team Site.
I wanted to add Custom CSS to a Calendar list. I am unable to see Content Editor Webpart or Script Editor webparts.
I have enabled Publishing features as well.
Do you know is there a way to add custom css on top of calendar.

Appreciated your help!
Thanks

Microsoft 365 and Office | Office Online Server
Microsoft 365 and Office | SharePoint | For business | Windows
Microsoft 365 and Office | SharePoint Server | Development
0 comments No comments
{count} votes

Accepted answer
  1. MichaelHan-MSFT 18,126 Reputation points
    2020-12-08T07:43:38.093+00:00

    Hi @Krishna Sandeep Sangani ,

    You need to allow custom script on your sharepoint site to add Content Editor Webpart or Script Editor webparts. Please refer to this article for more: allow-or-prevent-custom-script

    You can allow custom script on a particular site immediately with the below powershell command:

    Connect-SPOService https://tenant-admin.sharepoint.com  
    Set-SPOsite https://tenant.sharepoint.com/sites/yoursite -DenyAddAndCustomizePages 0  
    

    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


2 additional answers

Sort by: Most helpful
  1. trevorseward 11,711 Reputation points
    2020-12-08T17:47:12.55+00:00

    Manipulating the DOM, thus CSS customizations, are not supported with Modern sites. You would need to otherwise use an SPFx solution but as Microsoft may make changes to the DOM at any time, you shouldn't expect any CSS changes to function indefinitely.

    0 comments No comments

  2. MichaelHan-MSFT 18,126 Reputation points
    2020-12-09T04:07:07.807+00:00

    Hi @Krishna Sandeep Sangani ,

    Another workaround is to change the Alternate CSS URL in Master Page. This needs to enable publishing feature.

    1. Upload your css file to a library.

    46419-image.png
    2. Go to site settings-> Master page, expand the Alternate CSS URL option. Add the reference to your css file.

    46440-image.png

    46398-image.png

    Test Result:

    46390-image.png


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.