1

I want to add styles to the web part pages in visual studio. Is it possible to use CssLink? How This control works?

2 Answers 2

0

You can use CssRegistration or simple link html tag for your custom styles control in .ascx:

<SharePoint:CssRegistration Name="/_layouts/15/MySolutionFolder/CSS/styles.css?v1" runat="server" />

CssLink control does big job with SP default styles, read more here.

1
  • Thanks for reply. Whereas I am novice in using Share Point I have put this link in header. It didn't work. Should I change the name? for example this root is ok"C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\LAYOUTS\1033\STYLES\Themable\COREV15.CSS"
    – Mohammad
    Dec 28, 2017 at 8:32
0

The difference between CssLink and CssRegistration :

http://blogs.catapultsystems.com/tlingenfelder/archive/2007/10/24/the-sharepoint-csslink-and-cssregistration-server-controls/

If you want to add styles to the web part pages , I suggest you can use CssRegistration because CssLink server control must reside on the master page .

https://docs.microsoft.com/en-us/sharepoint/dev/solution-guidance/use-css-to-brand-pages

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.