29 replies [Last post]
Jean
Offline
Regular
Last seen: 16 years 29 weeks ago
Joined: 2005-04-07
Posts: 13
Points: 0

What a brilliant forum. Hope you don't mind newbie questions.

I am quite new to external style sheets. I am using Dreamweaver MX 2004 and have created a dynamic web template. All my local files look perfect - in accordance with the style sheet. However, when I upload my pages, the style sheet doesn't appear to be linked. Below is the code on my template. I have checked that none of my pages have become detached from the template.

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

Is there something wrong with this link. If I remove the first '/' I lose all the style. I have also tried '../', and that doesn't work either.

Can anyone shed any light on this. Browser is IE6.

Tony
Tony's picture
Offline
Moderator
Brisbane
Last seen: 1 week 1 day ago
Brisbane
Timezone: GMT+10
Joined: 2003-03-12
Posts: 5344
Points: 2965

Linking external style sheets

Hi Jean,
Can you post a link to the site, it would help a lot.
You could try giving the full address of the stylesheet.

Jean
Offline
Regular
Last seen: 16 years 29 weeks ago
Joined: 2005-04-07
Posts: 13
Points: 0

Linking external style sheets

Tony Hi

Thank you for your response.

The site is http://www.petmag.co.uk. You will see how bad it is. The correct style should be a fixed 800 wide, black nav bar with white lettering, black left and right bars. Even the logo is wrong.

I have not re-uploaded the whole site, but you will see what I mean from the index page. It's just so embarrassing as it is at the moment. All my local files are perfect.

Guy
Guy's picture
Offline
Enthusiast
Cambridge, UK
Last seen: 11 years 40 weeks ago
Cambridge, UK
Timezone: GMT+1
Joined: 2004-04-26
Posts: 54
Points: 0

Linking external style sheets

Try removing the forward slash from the front of the link!

i.e.
From:
<link type="text/css" media="all" rel="stylesheet" href="/styles/style.css" />
To:
<link type="text/css" media="all" rel="stylesheet" href="styles/style.css" />

Hope that works,

Guy

Who discovered we could get milk from cows, and what did he THINK he was doing at
the time? - Billy Connolly

Jean
Offline
Regular
Last seen: 16 years 29 weeks ago
Joined: 2005-04-07
Posts: 13
Points: 0

Linking external style sheets

Guy

Nope that doesn't work either. In fact that takes the style off the local files. Think I'm going a bit grey over this one.

Anonymous
Anonymous's picture
Guru

Linking external style sheets

How about:
<link type="text/css" media="all" rel="stylesheet" href="./styles/style.css" />

maybe :?:

Jean
Offline
Regular
Last seen: 16 years 29 weeks ago
Joined: 2005-04-07
Posts: 13
Points: 0

Linking external style sheets

Triumph

Thank you, but that doesn't work either. Crying

Lorraine
Lorraine's picture
Offline
Elder
UK
Last seen: 16 years 32 weeks ago
UK
Timezone: GMT+1
Joined: 2005-01-04
Posts: 1001
Points: 0

Linking external style sheets

Jean
When you say your local files are perfect, do you mean in Dreamweaver preview or in an actual browser? The DW (or any wysiwyg, for that matter) preview cannot be trusted and you should always check your design as you go along in an actual browser. The consensus on this forum is to design for and check in Firefox, then check in Internet Explorer for any IE specific code that may be needed.

I don't think it's your stylesheet link that's the real problem, because the stylesheet is actually in the place to which you link.

You have a Javascript error (see attachment) and the page does not validate. See http://validator.w3.org/check?uri=http%3A%2F%2Fwww.petmag.co.uk%2F. Leaving aside the non-XHTML 1.0 Strict code courtesy of Google ads, there are quite a number of other coding problems that could be affecting how the page is displayed. Until it does validate, the css cannot be validated, see http://jigsaw.w3.org/css-validator/validator?uri=http%3A%2F%2Fwww.petmag.co.uk%2F

You might like to go to the Forum Index and look in the How To section for why html and css validation is important.

I have to say, I don't think DW is doing you any favours here and if you want to go down the html/css road, then hand-coding would be the best way forward.

rmfred
rmfred's picture
Offline
Elder
Rock Springs, WY
Last seen: 4 years 25 weeks ago
Rock Springs, WY
Timezone: GMT-6
Joined: 2004-01-31
Posts: 1073
Points: 31

Linking external style sheets

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

and I would get rid of this:
<style type="text/css">
</style>

right before the </head>
and this:

<style type="text/css">
<!--
.style7 {font-weight: bold}
-->
</style>

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 2 years 4 weeks ago
Dallas
Timezone: GMT-6
Joined: 2004-06-25
Posts: 9776
Points: 3858

Linking external style sheets

The path seems ok, and Firefox is showing the page just fine. IE, however appears not to know about the stylesheet. If this jibes with your results, then the path is not the problem.

I do have to wonder what this is all about;

Not Found
The requested URL /accessibility/js/' + dirLevel + '../styles/style_gb_large' + styleSuffix +'.css was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. 
There are 23 of these little puppies.

Lose the browser sniffer. They're not needed, and they don't really work anyway.

Correct your DTD. It should be

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
When incomplete, browsers go into quirks mode. In IE's case, Bad Things Can Happen™.

cheers,

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.

Lorraine
Lorraine's picture
Offline
Elder
UK
Last seen: 16 years 32 weeks ago
UK
Timezone: GMT+1
Joined: 2005-01-04
Posts: 1001
Points: 0

Linking external style sheets

Quote:
Firefox is showing the page just fine.

I'm intrigued Gary - is your version showing
Quote:
The correct style should be a fixed 800 wide, black nav bar with white lettering, black left and right bars.

see Jean's post 7 Apr 2:18pm
'cos if it is, I've got some problems with Fx1.0 (can't be bothered to upgrade - again).

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 2 years 4 weeks ago
Dallas
Timezone: GMT-6
Joined: 2004-06-25
Posts: 9776
Points: 3858

Linking external style sheets

Lorraine wrote:
Quote:
Firefox is showing the page just fine.

I'm intrigued Gary - is your version showing
Quote:
The correct style should be a fixed 800 wide, black nav bar with white lettering, black left and right bars.

I've got a burnt orange background on the navbar and sidebars. If I edit #headnav1 {background: del(#e9a241) ins(#000);} it goes black.
Quote:
see Jean's post 7 Apr 2:18pm
'cos if it is, I've got some problems with Fx1.0 (can't be bothered to upgrade - again).
It renders correctly only when I'm in 'edit css' mode. Else, the stylesheet has no effect. I didn't notice this 'til you questioned my integrity. Laughing out loudTongue My first check was done in a window that was in that mode. :shrug:

I have the feeling the problem is related to the 23 404s. Are scripts calling them? I won't bother to 1) search through scripts, or 2) dig through table markup. Somewhere these files are being requested and I think the browser renders what it has and when the stylesheet(Drunk are finished loading, it doesn't redraw itself. When in edit css mode, it does redraw itself.

I think, Jean, you are going to have to find those links and shut them down.

cheers,

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.

Jean
Offline
Regular
Last seen: 16 years 29 weeks ago
Joined: 2005-04-07
Posts: 13
Points: 0

Linking external style sheets

Gosh

Thanks all. I have printed off all your suggestions and will make some alterations tonight. Unfortunately I have a full time job so can only work on my site in the evenings.

By the way:

Quote:
I've got a burnt orange background on the navbar and sidebars. If I edit #headnav1 {background: del(#e9a241) ins(#000);} it goes black.

Sorry about that, I changed it last night having designed a new logo. It is now meant to be orange. I thought the black looked a bit harsh.

Lorraine

I did mean they look perfect in Dreamweaver and not the browser. I will check out the validation tonight.

Your comment about hand-coding - if only I could - only been doing this for a few months. Would not be able to hand code yet. I'm not at all knowledgeable about CSS either. The file was given to me so that I could just amend my colors etc as needed. I am learning quite quickly though.

Thank you all again for your help. I will let you know how I get on.

timhobbs
timhobbs's picture
Offline
Regular
Monterey, CA
Last seen: 19 years 22 weeks ago
Monterey, CA
Timezone: GMT-8
Joined: 2003-10-27
Posts: 37
Points: 0

Linking external style sheets

Don't quote me on this, but I believe I read about an IE bug (GASP!) when you set a "media" type for the style sheet. Try this:

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

Hope this helps,
Tim

Jean
Offline
Regular
Last seen: 16 years 29 weeks ago
Joined: 2005-04-07
Posts: 13
Points: 0

Linking external style sheets

Well I have tried everything now. Still it doesn't work. Clutching at straws, but could I have a bug in my Dreamweaver programme?

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 2 years 4 weeks ago
Dallas
Timezone: GMT-6
Joined: 2004-06-25
Posts: 9776
Points: 3858

Linking external style sheets

Jean wrote:
Well I have tried everything now. Still it doesn't work. Clutching at straws, but could I have a bug in my Dreamweaver programme?
Am I the only one seeing all those (23) requests for stylesheets that result in 404s? If not, what have you done about them? Even if they're not the problem, they're ugly and you should lose them.

I just did recheck your page. Several octothorpes are missing from background colors, eg. EABF40 instead of #EABF40.

cheers,

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 8 years 11 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

Linking external style sheets

Your not the only one Gary, I've seen them as well

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> 
<HTML><HEAD> 
<TITLE>404 Not Found</TITLE> 
</HEAD><BODY> 
<H1>Not Found</H1> 
The requested URL /accessibility/js/' + dirLevel + '../styles/style_large' + styleSuffix +'.css was not found on this server.<P> 
<P>Additionally, a 404 Not Found 
error was encountered while trying to use an ErrorDocument to handle the request. 
</BODY></HTML>

and am at a loss to explain them. Time to strip out all extraneous code, back to basics it's not, I think, a DW problem.
What's the little bit of javascript code that looks like a styleswitching function? 'setPageStyle()'

Hm, just noticed that you have two instances of the meta character tag you may want to correct that and also use a full url DTD for standards mode.

Hugo.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 2 years 4 weeks ago
Dallas
Timezone: GMT-6
Joined: 2004-06-25
Posts: 9776
Points: 3858

Linking external style sheets

Hugo: You're right about the js. Look at this pile of [mode="self-censor"]*beep*[/mode]. That bit of script writes 23 links to stylesheets.

Jean: You really do need to follow some of the suggestions.

    Use a complete and proper DTD as both Hugo and I mentioned.
    I think someone suggested you validate your html and css. If not, you should. There are errors.

    I said earlier that you should rid yourself of the browser sniffing script.

    I said you needed to find the source of the spurious css requests. They're still there. Hugo suggested that 'setStyles.js' might be the problem, and I verified. Lose that script.
It is said that 'god helps those who help themselves'. That applies here, too. While Hugo is a certified guru, his explanations sometimes lack clarity[1] Wink. If you don't quite grok a suggestion, come back for clarification, don't let it go.
cheers,

gary

[1]Mine, otoh, are crystal Tongue

[/]

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.

thepineapplehead
thepineapplehead's picture
Offline
Moderator
Last seen: 48 weeks 3 days ago
Timezone: GMT+1
Joined: 2004-06-30
Posts: 9683
Points: 819

Linking external style sheets

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">

I'm sorry, HTML2.0? What version of DW are you using? Laughing out loud

Verschwindende wrote:
  • CSS doesn't make pies

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 8 years 11 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

Linking external style sheets

with customary alacrity our hidden treasure Gary wrote:
While Hugo is a certified guru, his explanations sometimes lack clarity :wink:[1]

[1]Mine, otoh, are crystal Tongue
ooh, there's one post.........

Laughing out loud look I'm a flipping Guru, my explanations are not meant to be clear just rather obtuse, deep, sage like, I'm meant to ramble in an esoteric fashion. it's for the student to fathom the meaning in my words Smile

and never a truer word said in jest !

Reading through the thread it became somewhat clear that the problem was undoubtedly pin downable to something i.e it wasn't just the fairies at work and fairly clear after a while what it almost certainly was. At the end of day it would have taken little time to solve really :roll:

Wow what a bit of script Shock I have to admit that I didn't think to hunt it down to confirm my supposition.

Jean I would take on board what Gary has said and thank him for making clear what I hinted at in confirming for you the root cause of the problem it's what makes him one of the more dedicated members of the forum and rightly a hidden treasure (sorry just had to get that in one more time Gary Smile )

Hugo.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

Jean
Offline
Regular
Last seen: 16 years 29 weeks ago
Joined: 2005-04-07
Posts: 13
Points: 0

Linking external style sheets

Oops!! Didn't mean to cause a storm. What I have done so far.

Tried various DTD headings.
Printed off the validation report and went through the 72 errors. Did not change all as some referred to the styling and were (I have to assume correct).

The 23 links were probably to the accessibility page which I have since taken out for now.

The whole site had not been uploaded at the time of posting - only the index page, so the errors/bad links on other pages were because of this.

Sorry, haven't yet removed the sniffer.js - will do this tonight.

I am amazed at the problems as this template and css file was created by a 'professional' charging a lot of money (glad it wasn't me paying).

One thought - It was originally created for a php driven site - could that be the problem as mine is just a 'simple' html site.

Another thing I was going to try tonight - if you think it worth it- was to move the css onto the template. I would rather not do this as it defeats the object of trying to keep the html clean.

Thank you all for your support on this - it really is appreciated.

Quote:
look I'm a flipping Guru, my explanations are not meant to be clear just rather obtuse, deep, sage like, I'm meant to ramble in an esoteric fashion. it's for the student to fathom the meaning in my words

Bless! If only my aged brain could. I always thought I was clever on a computer till I started web building.

I will do a bit more work tonight - perhaps change the 'strict' to 'transitional'.

Could someone take another look now all the files have been uploaded. Hopefully there will be a few less errors.

Many many thanks.

thepineapplehead
thepineapplehead's picture
Offline
Moderator
Last seen: 48 weeks 3 days ago
Timezone: GMT+1
Joined: 2004-06-30
Posts: 9683
Points: 819

Linking external style sheets

Quote:
perhaps change the 'strict' to 'transitional'.

Don't. Leave it as strict and fix your coding errorrs.

Verschwindende wrote:
  • CSS doesn't make pies

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 2 years 4 weeks ago
Dallas
Timezone: GMT-6
Joined: 2004-06-25
Posts: 9776
Points: 3858

Linking external style sheets

Jean,

  1. For any new page, use a strict DTD. Be sure you use the complete version, including the url, eg.
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    antibland: That's my story, and I'm sticking to it. Tongue

  2. Remove these lines from your doc;
     
    <script type="text/javascript" src="/js/randomad_home.js"></script> 
    <script type="text/javascript" src="/js/sniffer.js"></script> 
    <script type="text/javascript" src="/js/cookies.js"></script> 
    <script type="text/javascript" src="/js/setStyles.js"></script> 
     
    <script type="text/javascript"> 
    		<!-- 
    		setPageStyle() 
    		//--> 
    		</script>
    If you really must have them, add them back after everything's working correctly.

  3. You still have not corrected the lack of octothorpes on the numeric color values. That's a requirement. Where you have {background-color: 123456;}, it should be {background-color: #123456;}.
  4. Correct the validation errors. Invalid code can cause unexpected behavior.
  5. Once the xhtml is correct, validate the css.
It's not that big of a job. Get rid of the trouble makers first. Then clean up the errors a step at a time.
cheers,

gary

[/]

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.

thepineapplehead
thepineapplehead's picture
Offline
Moderator
Last seen: 48 weeks 3 days ago
Timezone: GMT+1
Joined: 2004-06-30
Posts: 9683
Points: 819

Linking external style sheets

The validation errors are easy to fix. There are simple things like adding alt tags in images, making sure your tags match, and this:

Quote:
Line 62, column 48: cannot generate system identifier for general entity "linkid"

...ttp://www.awin1.com/show.php?mid=771&linkid=22817&aid=38051" border="0" alt="

This is because your links use &, instead of the ASCII equivalent, which is &amp;

Verschwindende wrote:
  • CSS doesn't make pies

Jean
Offline
Regular
Last seen: 16 years 29 weeks ago
Joined: 2005-04-07
Posts: 13
Points: 0

Linking external style sheets

Quote:
Line 62, column 48: cannot generate system identifier for general entity "linkid"

...ttp://www.awin1.com/show.php?mid=771&linkid=22817&aid=38051" border="0" alt="

I didn't understand this - I haven't changed that. I had taken out the AW comments at start and end of ad and thought that had affected it, so I put them back in.

My wonderful husband of 36 yrs today is re-uploading the whole site. I will see if he can make the change first.

I confess I have changed the DTD to transitional out of desperation. A friend told me he could see my index page in IE, but I still can't. I've worn out the Ctrl F5.

I will change the DTD back to strict as soon as I have understood all the validation errors.

Of the 34 errors showing on the validation report, there are quite a few saying I can't use "target="_blank". What is this all about. How do I get my pages to open up in a new window using css?

The randomad.js are my banners next to the logo. I have three rotating. The alts I can fix no problem. The aligns I can fix.

It's taking some time, but thanks to your help everyone, I am sure I will get there in the end. If I haven't made a correction, it is because I have just missed it, or have not understood it. I will re-validate this evening and just keep making the corrections. If I get stuck I will come back for help.

For a newbie, this has been the most positive experience I have had since starting this venture. You guys/gals are the biz.

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 2 years 4 weeks ago
Dallas
Timezone: GMT-6
Joined: 2004-06-25
Posts: 9776
Points: 3858

Linking external style sheets

Jean wrote:
Of the 34 errors showing on the validation report, there are quite a few saying I can't use "target="_blank". What is this all about. How do I get my pages to open up in a new window using css?
You can't in xhtml1+ strict. If you really need to have it as an attribute, i.e. <a href="some.html" target="">, then you need to use html4 as a DTD.

The 'proper way' to do things is to use javascript in a manner that fails gracefully.
 
<a href="some.html" onclick="return !window.open(this.href);">
That is an elegant piece of code that fails gracefully. If the js is disabled/missing, it acts as a normal link. Should the js somehow fail to open the new window, it returns 'true' (!false), so the link activates. Should the new window open properly, the js returns 'false' (!true) and the link is not triggered.

cheers,

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.

thepineapplehead
thepineapplehead's picture
Offline
Moderator
Last seen: 48 weeks 3 days ago
Timezone: GMT+1
Joined: 2004-06-30
Posts: 9683
Points: 819

Linking external style sheets

IIRC (only found out what that means yesterday!), Xhtml 1 transitional allows you to use target blank.

Quote:
I didn't understand this - I haven't changed that. I had taken out the AW comments at start and end of ad and thought that had affected it, so I put them back in.

I know. When you link to search results and stuff, the address often contains the ampersand symbol. To validate, you need to change it to this:

&amp;

The link will still work fine though.

Quote:
The randomad.js are my banners next to the logo. I have three rotating.

If you have a php-enabled server, use that instead. I don't know why, I just prefer php over JS.

Quote:
For a newbie, this has been the most positive experience I have had since starting this venture. You guys/gals are the biz.

Yes, we rule. Laughing out loud

Verschwindende wrote:
  • CSS doesn't make pies

Jean
Offline
Regular
Last seen: 16 years 29 weeks ago
Joined: 2005-04-07
Posts: 13
Points: 0

Problem solved

We have lift off. Site now working. Still needs a tweak here and there, but at least it's the right shape and the right colours. Many many thanks to all who helped.

I shall now strive for perfection using the 'strict' and validation tool. That is so the best piece of kit.

Thanks again.

antibland
antibland's picture
Offline
Leader
Pittsburgh
Last seen: 14 years 11 weeks ago
Pittsburgh
Joined: 2005-01-17
Posts: 603
Points: 0

Linking external style sheets

I can't believe after all that, the site still doesn't validate. Kind of ruffles the feathers a bit.

Antibland

red58
Offline
Regular
Canada
Last seen: 16 years 3 weeks ago
Canada
Joined: 2005-03-21
Posts: 38
Points: 0

Linking external style sheets

I'm a newbie at this stuff, so maybe I'm not looking at things right, but when I view the source of that page in my editor, I see an extra DTD URI in the DTD tag, and doesn't the URI for HTML4.01 link to 4.01, rather than just 4? and NO beginning <html> tag - this doesn't cause problems with validation and quirks mode?? I tried validation and got a bunch of META errors that I'd expect were caused by the lack of the <html> tag

I've also noticed on the pages of a friend who uses dreamweaver that the template use results in extra, duplicate, things, such as the 2 charset and author meta's on that page, and 'encourages' forgetting possible crucial things by letting you believe the template provides anything you don't think of!!

I'm learning a lot here just following the excellent detective work of you "gurus", especially the "rather obtuse, deep, sage like" ones, as they make me think!! Laughing out loud

Bill