rocknbil - 4:45 pm on Mar 13, 2012 (gmt 0)
The image is in the same directory as the index file.
But where is the CSS?
The image must be relative to the location of the CSS. So if you have
you must do this in your document,
<link rel="stylesheet" href="/css/style.css" type="text/css">
... and this in your CSS.
The leading slash means "start at the domain root." It's a good habit to form early. Note that this will NOT work if you're previewing on your local computer because your local computer is not a web server and doesn't have a "domain root" (unless you add server software to it.) Using the above directory structure, you'll have to do
<link rel="stylesheet" href="css/style.css" type="text/css">
This will work in both cases, so what's the difference? When you get into large web sites and begin URL rewriting, it will become painfully apparent that the document-relative syntax will get very difficult to maintain. IF you always start at domain root, it's one less thing to worry about.