A Conversation for Website Developer's Forum
- 1
- 2
Mozilla and CSS stylesheets
Jonny Started conversation Sep 26, 2002
Hi!
I've written a website using XHTML and a CSS stylesheet. I've got both IE6 and Mozilla 1.1 on this computer, when I look at the version of it on my hard drive at the moment using both Mozilla and IE6 it looks fine. But when I upload the files, and go to the URL in both browsers, it looks fine in IE6 but Mozilla seems to be completely ignoring the stylesheet. I really don't understand why its doing this, especially since it's working on the local version. Can anyone explain please?
Jonny
Mozilla and CSS stylesheets
Jonny Posted Sep 26, 2002
I've now managed to get it working by putting the CSS within some STYLE tags. Is there anything wrong with this line:
which I've been using to link to the stylesheet?
Mozilla and CSS stylesheets
DoctorMO (Keeper of the Computer, Guru, Community Artist) Posted Sep 26, 2002
nope looks fine to me, is the CSS directory relative? or maybe the Chmod settings arn't quite right.
-- DoctorMO --
Mozilla and CSS stylesheets
dElaphant (and Zeppo his dog (and Gummo, Zeppos dog)) - Left my apostrophes at the BBC Posted Sep 26, 2002
Mozilla will ignore the stylesheet if it's type is not declared, I think. So it should be
Another difference is if you link to two stylesheets and give them each a name or id (I can't remember which) Mozilla will allow you to switch between the two styles (under the "View" menu), but IE will combine them.
Mozilla and CSS stylesheets
DoctorMO (Keeper of the Computer, Guru, Community Artist) Posted Sep 26, 2002
I got three CSS documents linked to one resulting* HTML file, it works in both Mozzila, IE 5.0 and Konqueror. and it's just multipull
-- DoctorMO --
*Resulting because there generated by Perl.
Mozilla and CSS stylesheets
dElaphant (and Zeppo his dog (and Gummo, Zeppos dog)) - Left my apostrophes at the BBC Posted Sep 27, 2002
Mozilla also has a "quirks mode" that causes it to render the page differently (more like Netscape 4.x or IE) if you trigger it. It could be that the stylesheet swapping only happens in strict mode.
Mozilla and CSS stylesheets
dElaphant (and Zeppo his dog (and Gummo, Zeppos dog)) - Left my apostrophes at the BBC Posted Sep 27, 2002
For an example of the stylesheet switching, look here
http://teachx.rutgers.edu/jtest.html
Using Mozilla, click "View" --> "Use Style" and then switch between the two stylesheets. In IE they combine into something unholy.
Mozilla and CSS stylesheets
DoctorMO (Keeper of the Computer, Guru, Community Artist) Posted Sep 27, 2002
un froody is shourly is!
-- DoctorMO --
Mozilla and CSS stylesheets
Jonny Posted Sep 27, 2002
Thanks both of you! I've tried changing it to
but it's still not working . I've also managed to successfully build a page like that last link you gave me and it worked. So I really can't see what's going wrong!
Mozilla and CSS stylesheets
DoctorMO (Keeper of the Computer, Guru, Community Artist) Posted Sep 27, 2002
have you tried adding a base? have you got one? is the style sheet there? have you tried a refrance script?
-- DoctorMO --
Mozilla and CSS stylesheets
Ion the Naysayer Posted Sep 28, 2002
Have you Validated the XHTML? I'm guessing you have but it's worth asking. How about the CSS? Is there a missing ; or } somewhere? Did you transfer the files in ASCII mode? Have you looked at the actual stylesheet that's on the server to see if it got mangled in transit?
Does your DOCTYPE declaration include the XHTML URL? Mozilla could be in the wrong mode. Mozilla defaults to quirks mode unless you give it the full DOCTYPE including URL.
Mozilla and CSS stylesheets
DoctorMO (Keeper of the Computer, Guru, Community Artist) Posted Sep 28, 2002
I've seen sometimes how the wrong doc types can effect it, but that why I leave mine on default (blank)
-- DoctorMO --
Mozilla and CSS stylesheets
Ion the Naysayer Posted Sep 29, 2002
If you leave out the DOCTYPE, the browser has to make a guess as to what the heck it's reading. You should put in a DOCTYPE because it keeps the browser from having to guess (because it will actually guess wrong under certain circumstances and that will make the page render incorrectly). You can fairly easily find the right DOCTYPE on the W3C's website.
The HTML 4.01 DOCTYPEs are here:
http://www.w3.org/TR/REC-html40/struct/global.html
Mozilla and CSS stylesheets
DoctorMO (Keeper of the Computer, Guru, Community Artist) Posted Sep 30, 2002
it's not 'Content-type:text/html' by any chance?
Ah that would explain alot if it was. CGI pops up a 500 server error if you don't print this first.
-- DoctorMO --
Mozilla and CSS stylesheets
Ion the Naysayer Posted Sep 30, 2002
No, that's just the content type HTTP header (part of the protocol); the DOCTYPE is separate (part of the content).
Content-Type: text/html could be any form of HTML from 1.0-4.01 to XHTML 1.0. Giving the browser a DOCTYPE tells it which HTML version you're using.
Basically an http transaction goes like this:
Client connects to server's port 80
Client sends GET / HTTP/1.1\n\n
That is,
GET (the method)
/ (the document)
HTTP/1.1 (the protocol)
\n\n (two newlines to tell the server you're done sending info)
Server sends back
HTTP/1.1 200 OK
Date: Mon, 30 Sep 2002 13:50:45 GMT
Server: Apache/2.0.39 (Win32)
Content-Length: 2458
Connection: close
Content-Type: text/html;charset=utf-8
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
...
Which is:
HTTP/1.1 (protocol)
200 OK (return code - 404 is for not found, etc.)
The http headers should be pretty self-explanatory.
After Content-Type, the server sends two newlines to tell the client that's the end of the headers and then it starts to send content.
If you want to see this in action just fire up telnet, connect to port 80 of some random webserver and type in GET / HTTP/1.1
And actually you don't technically have to print the Content-Type as long as you print two newline characters before you start sending content. Not printing the newline characters is what causes the server error - you're not completing the HTTP transaction if you don't print them.
That's not to say that you SHOULD send content without specifying content type (as the client is then at liberty to guess what content type it is or just interpret the results as being Content-Type: application/octet-stream which is a BAD thing if you're sending HTML) but it's not strictly necessary to specify what the Content-Type is.
Ah, and I found a post from the www-validator mailing list about DOCTYPEs and why you should use them: http://lists.w3.org/Archives/Public/www-validator/2002Jul/0079.html Don't bother searching for '+why use doctype' on Google; it doesn't turn up anything useful anymore.
Mozilla and CSS stylesheets
DoctorMO (Keeper of the Computer, Guru, Community Artist) Posted Oct 1, 2002
Ah thanks, I knew it was /somthing/.
-- DoctorMO --
Mozilla and CSS stylesheets
Ion the Naysayer Posted Oct 2, 2002
No prob!
Hope not too many people are watching this thread - when I explain stuff like this people usually glaze over and do the "nod and smile" thing.
Mozilla and CSS stylesheets
Jonny Posted Oct 2, 2002
*glazes over*
*nods and smiles*
I've not replied for a few days. I've been reading what you're saying, and I've not had time to experiment for a while.
At the moment I've temporarily fixed the problem by putting the style in the style tags in the xhtml, but it's not the ideal solution. I'll have another look later!
Thanks!
Jonny
Mozilla and CSS stylesheets
DoctorMO (Keeper of the Computer, Guru, Community Artist) Posted Oct 2, 2002
I realised about the Perl printing method now, because I had to do some Cookies and you have to do it after the first bit but before the last \n, (new line)
-- DoctorMO --
Mozilla and CSS stylesheets
Ion the Naysayer Posted Oct 2, 2002
Ah, yes. Cookies can be a bit of a pain when they want to. Once I had tinkered with Cookies enough to figure out how they worked I chucked out the code I had written previously and downloaded the CGI and HTTP::Cookies modules from CPAN.
Without CPAN I think I would have to curl up in a corner and whimper a lot.
Key: Complain about this post
- 1
- 2
Mozilla and CSS stylesheets
- 1: Jonny (Sep 26, 2002)
- 2: Jonny (Sep 26, 2002)
- 3: DoctorMO (Keeper of the Computer, Guru, Community Artist) (Sep 26, 2002)
- 4: dElaphant (and Zeppo his dog (and Gummo, Zeppos dog)) - Left my apostrophes at the BBC (Sep 26, 2002)
- 5: DoctorMO (Keeper of the Computer, Guru, Community Artist) (Sep 26, 2002)
- 6: dElaphant (and Zeppo his dog (and Gummo, Zeppos dog)) - Left my apostrophes at the BBC (Sep 27, 2002)
- 7: dElaphant (and Zeppo his dog (and Gummo, Zeppos dog)) - Left my apostrophes at the BBC (Sep 27, 2002)
- 8: DoctorMO (Keeper of the Computer, Guru, Community Artist) (Sep 27, 2002)
- 9: Jonny (Sep 27, 2002)
- 10: DoctorMO (Keeper of the Computer, Guru, Community Artist) (Sep 27, 2002)
- 11: Ion the Naysayer (Sep 28, 2002)
- 12: DoctorMO (Keeper of the Computer, Guru, Community Artist) (Sep 28, 2002)
- 13: Ion the Naysayer (Sep 29, 2002)
- 14: DoctorMO (Keeper of the Computer, Guru, Community Artist) (Sep 30, 2002)
- 15: Ion the Naysayer (Sep 30, 2002)
- 16: DoctorMO (Keeper of the Computer, Guru, Community Artist) (Oct 1, 2002)
- 17: Ion the Naysayer (Oct 2, 2002)
- 18: Jonny (Oct 2, 2002)
- 19: DoctorMO (Keeper of the Computer, Guru, Community Artist) (Oct 2, 2002)
- 20: Ion the Naysayer (Oct 2, 2002)
More Conversations for Website Developer's Forum
Write an Entry
"The Hitchhiker's Guide to the Galaxy is a wholly remarkable book. It has been compiled and recompiled many times and under many different editorships. It contains contributions from countless numbers of travellers and researchers."