How to Apply Custom CSS in SharePoint sites ?

Atul Upadhye 0 Reputation points
2024-12-11T11:23:46.79+00:00

I am looking to implement SharePoint teams and communication sites . As part of this implementation, I am trying to use predefined Microsoft templates along with some level of customization using css.

As part of custom css implementation, I created a React JS app as per the Microsoft guidelines and added this as an app to our SharePoint site.

I had the following questions regarding custom css:

a) Custom css is not getting applied for guest users of SharePoint site. How to make custom css work for guest users.

b) Custom css is not getting applied consistently on all SharePoint templates. For example, the custom css applied successfully on a department team site template, but it did not get applied on project management team site template.

c) While developing custom css, I am identifying the SharePoint provided css class names and trying to override/extend those classes to incorporate required look and feel.

Any help regarding this will be greatly appreciated. Thank you in advance!

Microsoft 365 and Office SharePoint Development
{count} votes

1 answer

Sort by: Most helpful
  1. Xyza Xue_MSFT 30,176 Reputation points Microsoft External Staff
    2024-12-12T06:28:55.71+00:00

    Hi @Atul Upadhye ,

    Thank you for posting in this community.

    a) For guest users, custom CSS may not be applied consistently due to permission settings or restrictions in SharePoint. Ensure that the guest users have the necessary permissions to access the custom CSS files and that the CSS is included in a way that is accessible to them.

    b) The inconsistency in applying custom CSS across different SharePoint templates could be due to the varying structures and styles of those templates. Each template may have its own set of CSS classes and styles, which can affect how your custom CSS interacts with them. It's important to test and adjust your CSS for each specific template to ensure compatibility.

    c) When overriding or extending SharePoint's provided CSS class names, be cautious as these class names may change in future updates. It's advisable to avoid relying too heavily on specific class names and instead use more general selectors or custom classes to minimize the risk of your styles breaking with updates.

    References:


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    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.

    0 comments No comments

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.