-3

I have 8 php files in the folder for a website, and a styles.css that is included. At the beginning everything worked perfectly but now the website doesn't change when I change something in CSS. However, the site still uses what was already in the same css document. even if i kick the styles.css out of the folder, the styles are still loaded. Only when I remove the link in the html head (even if the link does not lead to a file when I remove it as a test) are the styles no longer applied.

I use VS Code, Chrome and XAMPP

2
  • 2
    Sounds like you got a run-of-the-mill caching problem. Use [ctrl]+[f5] to force a reload that circumvents the cache (or whatever the equivalent might be for your browser/system), or keep your browser dev tools open with the "Disable cache" option activated on the network panel. Commented Oct 20, 2022 at 10:45
  • 1
    Your browser might cache the CSS file. Use a "hard refresh" (Ctrl+F5 in most browsers) to force it to re-download a copy from the webserver. Commented Oct 20, 2022 at 10:45

1 Answer 1

0

In the head tag

<link rel="stylesheet" href="styles.css?v=<?php echo time(); ?>" >

This will reload the css everytime the page loads.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.