No matter how I link my stylesheet, the resulting page remains unstyled. HTML:
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
test test test
</body>
</html>
CSS:
@charset "UTF-8";
body {
background-color: #f25f29;
}
Both files are located in the same folder, which is test inside the xampp htdocs folder. Another website with stylesheet, which I have taken from a book in another subfolder inside htdocs is just fine. (I tried to figure out the mistake in my own page based on the working one, but I couldn't find it)
I already tried the following things:
- different paths
style.css./style.css/opt/lampp/htdocs/test/style.cssfile://opt/lampp/htdocs/test/style.css/test/style.css(since I guessed that the localhost takes htdocs as root directory)file://test/style.css
- matching the
charsetspecifier in CSS and HTML files (all uppercase) - using
/>to close the link instead of> - inserting a space between linkname and closing bracket
sudo chmod 777 *inside the test folder (changed it back to 644)- restarting xampp
- omitting the
type="text/css"specification - quadruple-checking the name of the stylesheet and its path
- I've had it never enclosed in
<style>tags - Also always used the straight quotation signs instead of the "italic" ones
The version that I have given above is the one that works in the other case.
Edit: Clearing the cache the cache fixed it, as suggested in the comments.