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


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.

| improve this answer | |
  • 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 '17 at 8:32

The difference between CssLink and CssRegistration :


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 .


| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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