locked
Custom CSS not applying to all users? RRS feed

  • Question

  • So I have created a custom CSS file and am calling it from the master page. Everything works fine when I am logged in as the Farm Admin but when I log in as just a domain user, I can't see the custom CSS changes....any idea why this is?

    The master page is checked in and approved, and the custom CSS is still not visible when the domain user logs in. Everything works looks fine when I am logged in as a Farm Administrator.

    Wednesday, June 27, 2012 9:29 PM

Answers

  • Hi,

    It sounds as though your custom stylesheet is sort of loading for standard users. When you linked to style sheet in your master page, I am assuming you used the CSSRegiration tag? Did you remmeber to add After="corev4.css"? It's possible that for domain users the browser is loading the css stylesheets out of order and thus some styles from corev4 are not being overwritten for domain users. I haev not seen that before, but it's possible.

    Another solution would be to use Fiddler and IE Developer toolbar, or my preference, Firebug for Firefox. Load your page as a domain user and verify that your custom stylesheet loaded. In firebug, in the "Net" tab make sure that all files were successfully downloaded. If any are red, then click on them to find out what went wrong.

    After all fies load, use the selector tool in either IE Dev Toolbar or Firebug and start reviewing what styles were applied to say your nav elements and in what order. Are your styles even listed for a given element? Out of order maybe? Would adding the !important tag to a particular style fix the issue? etc. If you load your site in two browsers, one logged in as an admin the other as a domain user you should be able to use this techinique to figure out where the breakdown is.


    Eric Overfield - PixelMill - blog.pixelmill.com/ericoverfield - @EricOverfield

    • Marked as answer by tudorH Tuesday, July 3, 2012 4:03 PM
    Thursday, June 28, 2012 4:24 PM
  • Figured it out, but I'm not sure why this was the problem. So I had also added the jQuery library to the Style Library but they were not Checked In. I basically went in and checked all those files in and the CSS works fine now. I have no idea why since there was no JS script that had anything to do with the CSS file, it was just the jQuery library. Anyways, it all works now. Thanks for all the help!

    - Eric, thanks for the tips, if I fun accross the same issue again I will definitely use IE Developer toolbar to find out if styles are being applied. The CSSRegistration tag does have the After="corev4.css".

    • Marked as answer by tudorH Tuesday, July 3, 2012 4:03 PM
    Thursday, June 28, 2012 8:56 PM

All replies

  • I would recommend using fiddler to watch the HTTP traffic when pulling up the page as a domain user.  I'm guessing your users don't have permission to access the css file and are getting a 401 Unauthorized error behind the scenes.  To remedy this ensure your users have the proper SharePoint permissions needed to access the file.


    Determination conquers all things.

    Wednesday, June 27, 2012 10:28 PM
  • Where did you store the CSS file? You probably stored it in a Library like Style Library and forgot to publish a major version or approve the file.

    You can see it as Admin because you have Access. 


    Benjamin Niaulin Blog: http://bniaulin.wordpress.com

    Twitter: @bniaulin

    Thursday, June 28, 2012 12:46 AM
  • To add to Benjamin's response, make sure your users have permissions to read the CSS file.


    Mike Smith TechTrainingNotes.blogspot.com

    Thursday, June 28, 2012 2:33 AM
  • Alright so I've made sure the CSS file is checked in and published but I am still having issues. When I am logged in as a domain user I can only see some of the CSS changes. For example I can see my search bar is moved but not all navigation bar changes show up. Such as the links on the nav bar are not styled, however, the drop down for one of the links on the nav bar is styled. Any ideas why only some of the CSS is applied to the domain user site?

    EDIT: the CSS file is located in the Style Library folder if that helps...what permissions do the users need to be able to access this file?

    • Edited by tudorH Thursday, June 28, 2012 3:45 PM
    Thursday, June 28, 2012 3:28 PM
  • Hi,

    It sounds as though your custom stylesheet is sort of loading for standard users. When you linked to style sheet in your master page, I am assuming you used the CSSRegiration tag? Did you remmeber to add After="corev4.css"? It's possible that for domain users the browser is loading the css stylesheets out of order and thus some styles from corev4 are not being overwritten for domain users. I haev not seen that before, but it's possible.

    Another solution would be to use Fiddler and IE Developer toolbar, or my preference, Firebug for Firefox. Load your page as a domain user and verify that your custom stylesheet loaded. In firebug, in the "Net" tab make sure that all files were successfully downloaded. If any are red, then click on them to find out what went wrong.

    After all fies load, use the selector tool in either IE Dev Toolbar or Firebug and start reviewing what styles were applied to say your nav elements and in what order. Are your styles even listed for a given element? Out of order maybe? Would adding the !important tag to a particular style fix the issue? etc. If you load your site in two browsers, one logged in as an admin the other as a domain user you should be able to use this techinique to figure out where the breakdown is.


    Eric Overfield - PixelMill - blog.pixelmill.com/ericoverfield - @EricOverfield

    • Marked as answer by tudorH Tuesday, July 3, 2012 4:03 PM
    Thursday, June 28, 2012 4:24 PM
  • Figured it out, but I'm not sure why this was the problem. So I had also added the jQuery library to the Style Library but they were not Checked In. I basically went in and checked all those files in and the CSS works fine now. I have no idea why since there was no JS script that had anything to do with the CSS file, it was just the jQuery library. Anyways, it all works now. Thanks for all the help!

    - Eric, thanks for the tips, if I fun accross the same issue again I will definitely use IE Developer toolbar to find out if styles are being applied. The CSSRegistration tag does have the After="corev4.css".

    • Marked as answer by tudorH Tuesday, July 3, 2012 4:03 PM
    Thursday, June 28, 2012 8:56 PM
  • This usually happens to me when the CSS file is not published or approved yet. Where is your new CSS located? Have a look with SharePoint Designer or browse to it and publish/approve it.
    Tuesday, October 8, 2013 2:59 PM
  • Can you please let me know.. how can I publish the custom css file in style library? as of now... I am still working.. therefore.. please let me know how can I publish it from designer of using site contents menu.

    Thanks


    Rakesh murthy

    Monday, June 13, 2016 2:27 PM
  • Hello,

    Thank you so much for the information above. It gave me a clue. I could not find the Corev4.css in my custom master page. I checked in Seattle master page and found Corev15.css link. I copied that and placed it before my custom css link in my custom master page and boom it worked. 

    Your instruction saved me.

    Thank you so much

    Azita

    • Proposed as answer by Azita15 Friday, January 27, 2017 11:32 PM
    Friday, January 27, 2017 11:31 PM