Forum Moderators: not2easy
Then I open an html file and save it. Then it loses it's style. It's as if it can no longer see the style sheet. I don't even need to change anything in the code.
What am I overlooking here?
Thanks for your help :)
href="/offtheshelf/images/sky.css"
Are you testing on a web server (IIS, Apache...) on your laptop? The path to your CSS file is relative to the web root, so without being on a web server this is unlikely to work?! But then this would also fail to work before editing the file and you say it's OK initially... unless the stylesheet was somehow cached perhaps?! Hhhmmm...
try this:
<link rel="stylesheet" href="../offtheshelf/images/sky.css" type="text/css" />
Notice the dots before the /offtheshelf
Also, may I ask why you have your css file in with your images?
You could create a folder for your style sheets, and name it whatever you wish if you are worried about someone finding your stylesheet.
4~css
[edited by: SuzyUK at 3:55 pm (utc) on Mar. 7, 2008]
[edit reason] tidying [/edit]
Your preceding dots likely now breaks the CSS on the website. Using the ../ notation can be very dangerous to spiders and users alike. I would always avoid that.
The best thing to do here is to replicate your website on your laptop by installing Apache and PHP. Then you can use the same code on there as on the real website and have it all work as expected.
if you visit it through the url then /offtheshelf/images/sky.css will be taken from the webroot (which might be what your HTML editor is doing),
but if you just open the file like normal, then /offtheshelf/images/sky.css will likely be taken from the root of the drive it's stored on.