简体   繁体   中英

How to add SharePoint:CssRegistration to a Master page in SharePoint 2010

I must be doing something silly but I just can't get this to work. I'm trying to expand the width of the left Navigation pane where the Quick Launch and TreeView is located. From what I've dug up I understand the best to do this is to use an additional CSS file to override the s4-leftpanel style.

So I've created a file at /Style Library/NavigationWidth/NavigationWidth.css and added the following line to the v4.master:

<SharePoint:CssRegistration name="/NavigationWidth/NavigationWidth.css" After="corev4.css" runat="server"/> 

I'm pretty sure the path is probably wrong, tried a couple different combinations but no joy. And where exactly is the best place to add this tag in v4.master?

My Googling skills and proving extremely useless for this one so I'd be super grateful if someone can point out my error(s) please! Thanks.

It looks like the path to the file isn't valid. Try adding it this way:

<SharePoint:CSSRegistration name="/Style Library/NavigationWidth/NavigationWidth.css" runat="server" After="corev4.css" />

If you look at the path in reverse: this will add the CSS file in the NavigationWidth folder in the Style Library (library) in the root of the Site Collection.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM