简体   繁体   中英

How to link css files to work correctly with wamp server?

I have this line in the head of a php.page

<link href="css/header.css" rel="stylesheet" type="text/css" />

LiveView in dw - shows everything formated well (css works)
f12 (using wamp) - also works well.
Now, I changed some line in header.css (for example cell padding) - then File - Save All
Live View still works - shows the changes correctly
But f12 (wamp) does not show the changes.
If I move header.css file from css folder to the root folder (and change the link) - wamp works well
But I want to have my css files in css folder, not in the root folder. What is the solution, please?

Clear your browser cache. That should fix the issue. You can do it automatically if you use ctrl+F5 in your browser.

Find your web root path and append it to the css file

Example.

<link href="<?php echo $webroot?>/yourfolder/css/header.css" rel="stylesheet" type="text/css" />

You could use

<link href="css/header.css<?php echo '?rnd_'.urlencode(time()).'='.urlencode(rand()); ?>" rel="stylesheet" type="text/css" />

For debugging purposes this is ideal, because it appends a random query string to the CSS-file-request in order not to be cached.

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