Why css won't apply changes? - html

I have a problem when I try to import css from folder. When I change something in css file, it just won't apply changes. When I try it inside the folder where is my php file, it works well.
If I delete everything in css file it just don't do anything. Like the file is saved and anything I do it won't apply any changes.
<link rel="stylesheet" href="css/moj.css">

Press Shift when you reload. That will clear the cache and load the new CSS changes.
It is a rookie problem. Happy Coding.

Go into inspect element mode, and right click on refresh button (Chrome) and click "Empty cache and hard reload" .
This fixed my problem!

Have you tried pasting the whole URL (i.e. http://www.). I've found this to work sometimes when it is having trouble pulling the style sheet from another directory. Hope this helps!

Related

How can I get my stylesheet to merge into my HTML file?

I'm working on an assignment for class and I cannot get my CSS to attach at all to the html. I'll upload files as well as give the text-format of what exactly is going on but I've tried a few different things. I am a beginner but I have checked and double checked file paths. When I ctrl+click on the link within svc I consistently open the file. Chrome dev tools shows it as unable to find though.
This is my current set up in html5 :
what I see on vsc
my files are located in the same folder - the wireframe_stylesheet.css is definitely spelled correctly in both places. I've tried doing a / in front of wireframe. I've tried moving the file around and then adding / and folders. I've tried doing a long rout (not sure if it's the name) but all the way from C:// down to the file itself, and nothing seems to want to link it. I've also tried adding style="text/css" that didn't work either. I've tried adding the (.) before and after the file name, I've tried adding the folder above it so that it will go back into the file, I've tried adding a / after the " - still nope.
My html
My Css (sort of, there's more but this is the gist)
Try this
<link rel="stylesheet" href="./wireframe_stylesheet.css">
But I believe you've done something wrong in HTML code, share the full code so I can figure out what's wrong in it.
Use this snippet in between the head tag
<link rel="stylesheet" href=".Your CDs file name.css">

Website loading CSS files that do not exist

Whenever I make changes to files I am hosting for my website, like the CSS files, they never update. Even after deleting the original CSS files everywhere, using Chrome's inspect element still shows that the websites HTML is being styled by the "style.css" file that doesn't exist. The only way I have found around this is by changing the HTML pages to be styled by a "style2.css", and renaming my updated CSS file to "style2".
Is this not insanely weird? Ghost files? I'm not going crazy right?
Try refreshing with CTRL+F5 instead of only F5
This will clear the already cached files like css and js and will reload the updated ones
Let's say you have style.css
with
.body{
background-color:white;
}
after that you change the same style.css file to
.body{
background-color:black;
}
sometimes the navigator won't read the new code in css/js
and will load the old ones unless you clear them
This could be your problem, try it and check again
Or you could check out this case : How to force the browser to reload cached CSS and JavaScript files

Bad request for css file after moving wordpress site

After moving a wordpress site i noticed it didnt look the same so i figured there would be something wrong with a css file, turns out one of the css files of the lambda theme has a bad request and the request URL is constructed weirdly.
The left screen is the one after moving and the right screen is the fully working one that was moved.
Any suggestions?
The problem here is obvious (even thought the solution is not so obvious), There is a incorrect link to the css file on the page:
http://www.laakland.nl/wordpress4/D:/www/laakland.nl/www/wordpress4/wp-content/uploads/lambda/stack-493.css?ver=4.8.1
Since you said you didnt know where this is coming from, you can start here:
Check header.php to see if the CSS is added directly
Check functions.php to see if the CSS file has been added there using wp_register_style
Any plugins might have added this too, so you might check there too.
For convenience, use an IDE to search for the text stack-493.css on the whole wordpress folder to see if you find the file where it is being added from and then fix the link there.
Oke i fixed it, i tried the whole migration through duplicator plugin process again, but on step 3 of importing, i removed 'path' (which was "D:/www/xxxx.nl/www/wordpress4") so that after removing that, i thought it wouldnt add the unnecesary part from amit's answer.
thanks all!

CSS is refusing to update

My computer is having an error where the CSS stops working. For example before, when I modify the CSS and save it, it would work on the webpage and all would be fine.
Now however, if I edit and save the CSS the webpage does not change at all, its almost as if the CSS is stuck in a cached version or something.
I am using sublime text 3, wamp server and chrome.
Anyone have any ideas on what the error could be?
Do
CTRL + SHIFT + R
This will hard refresh your browser. This command helps you to clear the browser's cache for a specific page.
Try deleting images and files in cache.
Then you can also use a workaround if it's a cache problem: you can add a get version parameter to your css src when you include it, and upgrade the parameter.
For instance:
<link rel="stylesheet" type="text/css" href="your/src?v=0.1">
Then if you modify the css, you can change the v value
<link rel="stylesheet" type="text/css" href="your/src?v=0.2">
Without have to delete cache or something else
Close your files in text editor and open again your files in text editor.Recheck the file address you want to open in wamp server or open again.

Linking an External Stylesheet (HTML)

I am building my first website and I'm trying to attach an external css file...
Both my index.html and test.css are in the exact same folder/directory, but for some reason my test.css file isn't being linked...
Question: Does anyone know why my test.css isn't being linked?
//HTML (index.html)
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" media="screen" href="test.css">
<title>Page Title</title>
</head>
<body>
<h1>header of type 1</h1>
<p>standard paragraph</p>
<hr>
<p>HTML stands for Hyper Text Markup Language</p>
</body>
</html>
No need to worry, there's nothing wrong with your css code.
You just have to make sure that the 'href' part of your stylesheet link contains the name of the file your want to include, which in your case would be:
href="CSS Test.css"
Windows will hide the file extensions by default though, so make sure your file isn't actually called "CSS Test.css.css" after you added the extension a second time. To show all file extensions, do the following:
Open Folder Options by clicking the Start button Picture of the Start button, clicking Control Panel, clicking Appearance and Personalization, and then clicking Folder Options.
Click the View tab, and then, under Advanced settings, clear the Hide extensions for known file types check box, and then click OK.
Ok, thank you for all the quick responses, I have cleaned up my style thanks to both replies and I have kind of found the solution. I think "user5375312" was on the right track with the .css.css idea, that by adding .css I was somehow adding it twice. I don't think that's "exactly" what happened, but by creating a new css file, when I made it .css I also unchecked the "hide extension" box, which revealed a .txt, making my final file "Test.css.txt"
I removed the .txt keeping only the .css, saved the file to the same location, updated my page and the css file loaded in fine.
I'm still not sure what exactly went wrong or where, but I know it was either when I created the file the .txt was somehow still present when with previous files it was overridden or removed (something unique to creating css files maybe) or it was after I made the file, that some other setting caused it, but unchecking the hide extension box and making sure it saved correctly solved the problem, and I hope if anyone else encounters the issue that this helps.
Thanks again for the responses, it probably would have been days before I thought figured this out on my own, it was the mention of the .css.css possibility that drew that checkbox to my attention on my4th attempt at making a css file :D