question

Matt-9236 avatar image
0 Votes"
Matt-9236 asked MichaelHan-MSFT commented

Linking an external stylesheet to a SharePoint 2013 page

Hi,

I'm not sure how best to word this question, so I apologise if it isn't very clear.

I've recently designed a website using Visual Studio Code. I now need to replicate this website on a SharePoint 2013 site.

I understand that I can upload my stylesheets to the Site Assets library on the SharePoint site and link to them via Content Editor web parts on the Sharepoint site pages. However, I'm not sure how to update the stylesheets to bypass any CSS formatting already built in to the SharePoint pages.

To clarify, the website looks fine when viewed through the Live Server browser on VSC, but when I link to the same code from a SharePoint page it doesn't! Are there any simple changes I can make to the code for it work effectively on SharePoint? Or is it not that simple to replicate a webpage on a SharePoint page?

Thanks

office-sharepoint-server-administrationoffice-sharepoint-server-customization
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

MichaelHan-MSFT avatar image
0 Votes"
MichaelHan-MSFT answered MichaelHan-MSFT commented

Hi @Matt-9236,

To override css we usually use !important after every attribute of css. For example:


 .CssClass{
  color: red !important;
 }



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.



· 5
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @Matt-9236,

Is there anything update? Have you got this issue resolved?

0 Votes 0 ·

Hi Michael,

Apologies for the delayed response. I've been on leave from work for a few days.

Thanks for the suggestion. This is something I can try. It seems a big job to be applying !important to every CSS element though. I guess I hoped, as a non-SharePoint expert, that there might be a quick way to override any CSS built in to a SharePoint page, so only the content from the linked stylesheet is displayed.

0 Votes 0 ·

@Matt-9236,

These default sharepoint css styles are defined in the master page. So the quick way is changing the master page, but this would change the style in all sharepoint site, not only that page.

0 Votes 0 ·

Ok. Thanks for your help Michael :)

0 Votes 0 ·
Show more comments