468,136 Members | 1,432 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,136 developers. It's quick & easy.

Linking Style Sheets

Hi,
I have been looking for a way to incorperate several different
style sheets into a web page (i.e cascading effect).
I have looked into the @import statement which seems to do what
I want but unfortunately restrictions on the architecture may
this unfeasible. With the LINK tag I could use that but I
understand older browsers dont support it properly.

I will only ever have 2 style sheets. Is there a way to link
one style sheet to another from within itself? For example
I have a master style sheet and if an alternate style sheet
is provided I would like to include the master first (as the default)
at the top in the source of the alternate style sheet. There may be some
funky way out there to do this but couldn't put my finger on
it.

Any suggestions would be appreciated.
Luke Bellamy
Jul 20 '05 #1
2 3697
Luke Bellamy pounced upon this pigeonhole and pronounced:
Hi,
I have been looking for a way to incorperate several different
style sheets into a web page (i.e cascading effect).
I have looked into the @import statement which seems to do what
I want but unfortunately restrictions on the architecture may
this unfeasible. With the LINK tag I could use that but I
understand older browsers dont support it properly.

I will only ever have 2 style sheets. Is there a way to link
one style sheet to another from within itself? For example
I have a master style sheet and if an alternate style sheet
is provided I would like to include the master first (as the default)
at the top in the source of the alternate style sheet. There may be some
funky way out there to do this but couldn't put my finger on
it.


Call first style sheet from <head>:
<style type="text/css" media="screen, projection">@import
"../style/mymain.css"; </style>

Then from within "mymain.css" :

/* ---------------- The Menu ----------------- */
@import "mymenu.css";
/* ---------------- The Menu ----------------- */

--
-bts
-This space intentionally left blank.
Jul 20 '05 #2
be**********@hotmail.com (Luke Bellamy) writes:
I have been looking for a way to incorperate several different
style sheets into a web page (i.e cascading effect).
I have looked into the @import statement which seems to do what
I want but unfortunately restrictions on the architecture may
this unfeasible. With the LINK tag I could use that but I
understand older browsers dont support it properly.
@import will block NS4 and other old browsers, which is presumably
what you mean by 'restrictions on the architecture'.

<link rel="stylesheet" type="text/css" href="style1.css">
<link rel="stylesheet" type="text/css" href="style2.css">
<link rel="stylesheet" type="text/css" href="style3.css">

however seems to load all three properly in every browser I've tested,
including NS4 (not tried IE4 or IE3, which are the only other browsers
I'd imagine being old enough to have a problem with it).
I will only ever have 2 style sheets.
Well, for now...
Is there a way to link one style sheet to another from within
itself? For example I have a master style sheet and if an alternate
style sheet is provided I would like to include the master first (as
the default) at the top in the source of the alternate style
sheet. There may be some funky way out there to do this but couldn't
put my finger on it.


You could also use a preprocessor or similar.

--
Chris
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

16 posts views Thread by Geoff Cox | last post: by
3 posts views Thread by Phil Thompson | last post: by
11 posts views Thread by Safalra | last post: by
12 posts views Thread by Jarno Suni | last post: by
9 posts views Thread by Radium | last post: by
2 posts views Thread by Hallvard B Furuseth | last post: by
1 post views Thread by mscertified | last post: by
5 posts views Thread by =?Utf-8?B?SmVycnkgQw==?= | last post: by
27 posts views Thread by didacticone | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.