3

WAMP server loading index.html just fine but not loading any additional css style sheets and script files.

I've tried these

<link rel="stylesheet" href="wamp/www/AngularJS_Practice/css/style.css"/>
<link rel="stylesheet" href="/css/style.css"/>
<link rel="stylesheet" href="css/style.css"/>

edit

My current index.html page is

<!DOCTYPE HTML>
<html lang='en'>
<head>

<title>Electronic Components</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="css/style.css">

</head>
<body>
<h2>Lorem Ipsum</h2>


</body>
</html>

edit 2 css

h2 {

color: orange;
font-style: italic;

 }
7
  • Show us your file tree Commented Sep 6, 2015 at 18:37
  • The file tree for the index file is C:\wamp\www\AngularJS_Practice\index.html and the file tree for the css file is C:\wamp\www\AngularJS_Practice\css\style.css Commented Sep 6, 2015 at 19:16
  • it is preferred to write <!DOCTYPE html> , also UTF-8(uppercase) Commented Sep 6, 2015 at 22:16
  • Your html file seems to be correct , css file may have a error , can you add style.css too ? Commented Sep 6, 2015 at 22:22
  • Just added the css file (its very short because I'm using WAMP for the first time) Commented Sep 6, 2015 at 22:33

5 Answers 5

4

Refresh your browser cache. Press 'Ctrl+F5' That'll do the trick.

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

Comments

0

This worked for me:

<link rel="stylesheet" href=".\style.css">

Comments

-1

You forgot to use type

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

Also note

 <link ....>  // this is right
 <link ..../> // avoid this

Your HTML file seems right , try making this small css file in css folder and link to it

body{background-color:blue;}

Test this

5 Comments

Also remember that you have to link it in <head> tag.If you have a folder css in your working directory that contains style.css then this should work fine.
I tried adding type="text/css" but it the css still doesn't appear and yeah its in the head tag
Also see the code you pasted it has <link ..../> which is not right check this in you index.html. It would be better if you would upload the code of index.html for better understanding.
I just posted the index contents above
type is optional. XHTML style self-closing tags are required in XHTML and allowed in HTML 5.
-1

I had a same issue and what worked for me is this

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

Enjoy

Comments

-1

select the full url from url bar and then press ENTER... It works! ;)

2 Comments

Welcome to Stack Overflow! To me it is unclear how this would solve the OP's question. Please expand and clarify the steps and why it works.
when you select the url and then prress ENTER the header information is resent to the server(whether that be your local server or remote one)...since new header information is resend to the server a new page is requested from the server and hence your page will be refreshed and everything will work... If this don't work then try restarting your servers...HOPE IT HELPS

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.