문제

I have created css file called stylesheet1.css in folder called Mystyles. See image below

I want to refer css file in my visual studio in one of my .aspx page, so i wrote something like this but its not using this stylesheet

<link href="~sitecollection/_catalogs/masterpage/MyStyles/Stylesheet1.css"  />

Please can someone tell how can i refer this? Also could be nice if there are any articles which i can read about to get idea about referring images and css files in sharepoint in different ways.

enter image description here

도움이 되었습니까?

해결책

A correct way to reference a CSS from your master page is:

 <SharePoint:CssRegistration Name="&lt;% $SPUrl:~sitecollection/_catalogs/masterpage/MyStyles/Stylesheet1.css %&gt;" runat="server" After="corev15" />

Yup, surprising, but fully functionnal on my side! This is the only way to set a dynamic reference to a CSS...

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top