0

I needed to change the position of an element on my site page CSS.

The folder that contains the CSS is located in the Site Assets. I changed it and reuploaded it to the Site Assets, and when I open the file to check it it shows that I have changed it.

Now, when I load the page(s) where the issue needed to be fixed, it is still showing position: absolute; instead of position: relative;.

Any idea why my changes aren't updating on the actual page?

2
  • 1
    try deleting the CSS file and upload it again. Also, do hard refersh CTRL + F5 Commented Jul 27, 2021 at 5:46
  • @BeerusDev. Can you explain how exactly you are adding CSS to a SharePoint site? Are you using Alternate CSS? Commented Jul 27, 2021 at 19:09

2 Answers 2

1

Make sure that when you uploaded it, it retained the same name. Also ensure the file you edited was from the correct site collection. And finally do as Litt Spector suggested and either hard refresh or clear the browser cache completely. Alternatively try it in a Private Browsing/Incognito window or use a different browser altogether just to see if browser caching is the issue, it often is.

2
  • @Denis Molodtsov Calm down, I wasn't suggesting that was the best solution but just additional steps to diagnose the cause.
    – Marc
    Commented Aug 19, 2021 at 9:14
  • Sorry, maybe I spoke to harshly. But I still want to say in my opinion it's not only not the best solution, it's not even a solution at all. I have seen a lot of SharePoint developers who, in all seriousness ask users to refresh their browser cache. In most cases, because they don't know the right way. Since you didn't even mention the right approach, I assumed you also don't know how to do it correctly. Again, sorry if I'm being too harsh. Commented Aug 19, 2021 at 15:34
0

There are multiple techniques to deal with CSS updates. The easiest option is to append a suffix to the end of the URL. For example:

Instead of

https://contoso.com/assets/global.css

Use this URL

https://contoso.com/assets/global.css**?v=1**

Every time you update your CSS, increase the number:

https://contoso.com/assets/global.css**?v=2**

Then

https://contoso.com/assets/global.css**?v=3**

And so on.

This way you don't have to force users to clear the browser cache or use Incognito mode or similar nonsense techniques.

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.