Why Is My CSS Not Updating in Web Browser

Why is my CSS not updating in web browser?

Try a "hard" refresh of your browser...

http://en.wikipedia.org/wiki/Wikipedia:Bypass_your_cache

The idea is to bypass your browser's cache. Different browsers handle this differently, and this wiki article has a nice walk-through for each major browser on how to do this.

Alternatively, you could clear your browser's cache, which is also covered by the wiki article.

CSS not updating on change

Add ?v=1 behind the URL of the CSS link in the head, which will force using a non-cached version, because of the different (new) file name. The number should be unique, so if you want to use this in the future, make sure to replace the 1.

CSS file not refreshing in browser

Try opening the style sheet itself (by entering its address into the browser's address bar) and pressing F5. If it still doesn't refresh, your problem lies elsewhere.

If you update a style sheet and want to make sure it gets refreshed in every visitor's cache, a very popular method to do that is to add a version number as a GET parameter. That way, the style sheet gets refreshed when necessary, but not more often than that.

<link rel="stylesheet" type="text/css" href="styles.css?version=51">

CSS not updating in all browsers

This happens because it's faster for the user to load an already saved resource than downloading it again. This is the reason behind the resource caching. The time stablished for it to be used is finite and can be set to none at all disabling your cache (client-side); the time can also be set from the server.

The "trick" behind the style.css?version=1.0 is so that the browser gets a "new" URL to download according to your CSS "version". This being: if you have the file style.css?version=1.0 and you navigate to your page, that URL is going to be saved as an already loaded resource; when you change the file version to style.css?version=1.1 and you navigate to your page again, the browser doesn't have that "exact" URL registered, so it request that resource for the first time.

If you are working with a Back-End language you can do an easy workaround like style.css?version={getFileLastModificationTime}. With this, the resulting link will have the last time the file was modified as your "file version".

CSS changes are not getting reflected. Why?

I forgot to close a { in the CSS file.
That's why all the code didn't show up on the page.

The Browser Is Not Updating My CSS File When I'm Using XAMPP

You can add a version number to the css link like the folowing :

<link rel="stylesheet" type="text/css" href="style.css?ver=1.1/>


Related Topics



Leave a reply



Submit