|
-
May 1st, 2004, 02:12 PM
#1
Thread Starter
Frenzied Member
Attaching style sheets - which way? [resolved]
I use:
<link href='orange.css' rel="stylesheet" type='text/css' title='default' />
But I know you can also use:
@import url (orange.css);
Now, I would like to go over using the second way, but I have JS on my page which stores in cookies which style sheet the user has activated and displays the correct one. How can I do this with the new way of importing style sheets?
It's the title bit that the script reads, so that's what I need to keep. If it's very tricky, I'll use PHP instead, and use its cookies instead.
Last edited by Acidic; May 1st, 2004 at 06:03 PM.
Have I helped you? Please Rate my posts. 
-
May 1st, 2004, 03:18 PM
#2
The second way was invented in order to aggregate style sheets. I would use the first, since it means you don't need to have actual CSS in the HTML file. I'm also not sure if you can make a style tag an alternate stylesheet, you need to check the HTML spec of <style> for this.
Finally, NS4 doesn't recognize the second method, it's therefore very popular to hide advanced styles from NS4.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
May 1st, 2004, 04:02 PM
#3
Thread Starter
Frenzied Member
thx, but why does this not validate:
Code:
<link href='blue.css' rel='alternate stylesheet' type='text/css' title='blue' />
in 4.01 trans.
That's the reason why I considered changing over. I doubt it is the rel attribute as the error is:
document type does not allow element "LINK" here
When I click explain (in the w3.org validator) it doesn't really help.
I can't find where to see if the rel attribute actually exists in html 4.01.
Have I helped you? Please Rate my posts. 
-
May 1st, 2004, 04:11 PM
#4
A link element may only appear as a direct child of the head. Is yours anywhere else?
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
May 1st, 2004, 04:46 PM
#5
Thread Starter
Frenzied Member
Code:
1: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2: "http://www.w3.org/TR/html4/loose.dtd">
3: <html>
4: <head><title>Acidic Library - Home</title>
5: <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1' />
6: <link href='blue.css' rel='alternate stylesheet' type='text/css' title='blue' />
7: <link href='orange.css' rel="stylesheet" type='text/css' title='default' />
8: <script src='menu.js' type='text/javascript'></script>
9: <script src='misc.js' type='text/javascript'></script>
10: </head>
that's a direct chikd isn't it?
edit: aaah, direct child means that is comes directly after it, changed it, I still get errors, but not the same ones. Most probably dues to something else.
Have I helped you? Please Rate my posts. 
-
May 1st, 2004, 04:52 PM
#6
Thread Starter
Frenzied Member
OK, now I get the error that <head> is closed without being opened, why?
here's the code:
Code:
1: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2: "http://www.w3.org/TR/html4/loose.dtd">
3: <html>
4: <head>
5: <link href='blue.css' rel='alternate stylesheet' type='text/css' title='blue'>
6: <link href='orange.css' rel="stylesheet" type='text/css' title='default'><title>Acidic Library - Home</title>
7: <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1' />
8:
9: <script src='menu.js' type='text/javascript'></script>
10: <script src='misc.js' type='text/javascript'></script>
11: </head>
edit: never mind, found it. Its validates now YAY.
Last edited by Acidic; May 1st, 2004 at 04:56 PM.
Have I helped you? Please Rate my posts. 
-
May 1st, 2004, 04:54 PM
#7
Can you give me a link to the example page?
And no, direct child means that it is in the head tag, with no other tag wrapped around it.
Try removing the slashes on the empty elements, they're not needed in HTML and might (but should not, according to Appendix C of the XHTML 1.0 spec) confuse the validator.
Edit: Allright, never mind. What was the error?
Last edited by CornedBee; May 1st, 2004 at 05:00 PM.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
May 1st, 2004, 05:04 PM
#8
Thread Starter
Frenzied Member
I'm validating my page:
www.horspool.org.uk/sid.index.php
that one works now, I'm just working my way through the other pages.
Have I helped you? Please Rate my posts. 
-
May 1st, 2004, 05:06 PM
#9
Thread Starter
Frenzied Member
Originally posted by CornedBee
What was the error?
I'm not entirely sure, I got rid of the / at the end of the <link> tags and in the <meta> tag.
Have I helped you? Please Rate my posts. 
-
May 1st, 2004, 05:12 PM
#10
Link gives me a 404.
There's a special meaning in SGML (and thus HTML) to the / in a tag.
On the bottom line, only use /> if you're writing XHTML, which means giving the page an XHTML doctype and also serving it as application/xhtml+xml, application/xml, text/xml or any other xml MIME type.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
May 1st, 2004, 05:16 PM
#11
Thread Starter
Frenzied Member
sorry I meant:
www.horspool.org.uk/sid/index.php
I'll also have a read about XHTML, I've read stuff on it, but not enough.
Have I helped you? Please Rate my posts. 
-
May 1st, 2004, 05:23 PM
#12
Completely different issue, what do you know about character encodings?
The server reports your page as UTF-8, the meta in the head as ISO-8852-1. While the encodings are the same for common characters, they differ in, for example, German umlauts like ä.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
May 1st, 2004, 05:32 PM
#13
Thread Starter
Frenzied Member
Originally posted by CornedBee
what do you know about character encodings?
nothing. Should I change my char. enc. to UTF-8?
Have I helped you? Please Rate my posts. 
-
May 1st, 2004, 05:40 PM
#14
If that's what your editing software saves it as, yes. Otherwise you need to look into your server settings...
PHP always emits ISO-8852-1 though, unless treated with a filter in php.ini. Do you have access to the configs?
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
May 1st, 2004, 05:44 PM
#15
Thread Starter
Frenzied Member
no I don't have access. It's my friends sever, and I'm not even sure if he has access.
also, my flash page is far from validating. I use <embed> which I now realise is not what I should be using, <object> doesn't load the file though, what should I be doing here?
Have I helped you? Please Rate my posts. 
-
May 1st, 2004, 05:50 PM
#16
Check your <object> syntax 
Make sure you got the right clsid, the data file exists and all that.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
May 1st, 2004, 06:02 PM
#17
Thread Starter
Frenzied Member
Have I helped you? Please Rate my posts. 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|