Forum Moderators: not2easy

Message Too Old, No Replies

When I save my HTML file it no longer sees the CSS

I edit, save then the style is lost.

         

Familyman501

6:14 am on Mar 4, 2008 (gmt 0)

10+ Year Member



I'm using NoteTab Pro 4.92 as an HTML editor.
All my html files look great in a browser.

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 :)

4css

11:49 am on Mar 4, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you could cut and paste some of your code it might help.

Are you linking the style sheet or is it embedded into the page?

penders

11:52 am on Mar 4, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Then I open an html file and save it.

Save it and upload it to your web server? Is your stylesheet externally linked? All browsers?

Familyman501

11:20 pm on Mar 6, 2008 (gmt 0)

10+ Year Member



<link rel="stylesheet" href="/offtheshelf/images/sky.css" type="text/css" />

That's how I link to it.

I am working on a laptop. Previously on a PC. Could this be it?

Fails to find stylesheet in both Firefox and IE browsers.

H

penders

8:08 am on Mar 7, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



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...

4css

12:23 pm on Mar 7, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



As penders points out, make sure your path to the css file is correct. This happened to me once not long ago.

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]

penders

2:15 pm on Mar 7, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The path to your CSS file is relative to the web root...

Just a thought... do you have a <base> element at the top of your page? As this will naturally effect all relative links/paths.

g1smd

8:21 pm on Mar 7, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



@4css:

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.

londrum

8:47 pm on Mar 7, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



also remember that there is a difference between just opening a file in a browser, and having it parsed properly by a brower (by visiting the url [localhost...] for example)

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.

4css

9:42 pm on Mar 9, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



@ g1smd
I use it all the time depending on where I have the css files stored. I have yet to have it break anything.

Familyman501

8:49 pm on Mar 12, 2008 (gmt 0)

10+ Year Member



4CSS had a solutuion that works, thanks.
The two dots before work fine.

Thanks,
H

4css

9:36 pm on Mar 12, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Your welcome Familyman501,

I'm glad that you reported back that it worked as it helps others who might have the same problem.

Sometimes people will search for what you just had the problem with and by giving your resolution, you have helped out others. :)