navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

@import question

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> Cascading Style Sheets >> @import question
Page: [1]
 
hzarabet

 

Posts: 1540
From: New Milford CT USA
Status: offline

 
@import question - 4/29/2004 23:16:28   
Hi all...

Here is my @import tag

<link href="css/site_nn.css" type="text/css" rel="stylesheet" />
<style type="text/css">@import url(css/site.css);</style>

WHY OH WHY are changes I am making to css/site_nn.css, which should ONLY affect NS4, affecting my page when viewed on IE6?????

I am relearning the meaning of learning curve!

_____________________________

http://www.SigningsHotline.com lists EVERY upcoming athlete autograph appearance in the US and Canada
Giomanach

 

Posts: 6112
Joined: 11/19/2003
From: England
Status: offline

 
RE: @import question - 4/30/2004 0:25:38   
IE will be reading both Stylesheets, you need to use JavaScript to tell the browser which on to use

_____________________________




(in reply to hzarabet)
d a v e

 

Posts: 4136
Joined: 7/24/2002
From: England (but live in Finland now)
Status: offline

 
RE: @import question - 4/30/2004 1:23:00   
that's the idea that it reads both stylesheets. no javascript required
(see http://www.mako4css.com/csstwo.htm )
NN4 sees only the first sheet, IE and NN6+ merge both and give more importance to the second sheet due to the importance of the cascade. so if you don't make a declaration in *both* sheets then IE will pick up any unmatched styles from the first.

e.g.

NN4 sheet:
.warning {color:red}

IE sheet
.warning {color:yellow}

so NN4 can *only* see the first rule and warning text will be red.

IE takes the first rule *then* overwrites it with the more important rule that follows (why is it more important? because of the cascade) and it is yellow in IE

so if you have a style that *only* appears in the NN4 sheet then IE will see it as well and use only that because it doesn't have a version in its own sheet.

it's ok to put unique style rules in the IE sheet but not in the NN4 one

you need the same name (e.g. .warning) even though the details are different

_____________________________

David Prescott
Gekko web design

(in reply to Giomanach)
hzarabet

 

Posts: 1540
From: New Milford CT USA
Status: offline

 
RE: @import question - 4/30/2004 9:13:53   
Thanks Dave! Very Good explanation. I though is was "A" OR "B"!

_____________________________

http://www.SigningsHotline.com lists EVERY upcoming athlete autograph appearance in the US and Canada

(in reply to d a v e)
gorilla

 

Posts: 2974
From: Denmark
Status: offline

 
RE: @import question - 4/30/2004 18:08:37   
Nice reply indeed. My late colleague Karsten did a posting here:

http://www.frontpagewebmaster.com/m-165257/tm.htm

about this topic once you get to grips with it you can in effect "browser sniff" (Note the inverted commas please! :)) That site plone.org do exactly that.

< Message edited by gorilla -- 4/30/2004 18:09:57 >


_____________________________

Mháircaish

Signature self-censored to protect the sensibilities of the thin-skinned :).

May we never confuse honest dissent with disloyal subversion. – Dwight D. Eisenhower



(in reply to hzarabet)
Donkey

 

Posts: 3887
Joined: 11/13/2001
From: Blackfield United Kingdom
Status: offline

 
RE: @import question - 5/1/2004 8:27:55   
Supplementary Question

Why do you need to use @import? It works if you use two links to the two stylesheets and comment out the second one. Like this
quote:

<link href="/Styles/mozstyles.css" rel="stylesheet" type="text/css">
<!-->
<link href="/Styles/iestyles.css" rel="stylesheet" type="text/css">
<!-->


I picked this up in another forum a few months ago and I am using it to make sure that IE looks roughly the same as the other (compliant) browsers.

Another supplementary question
Why bother with NN4 users? (less than 1% globally - source:thecounter.com March2004 figures). Apparently over 96% of all browsers are MSIE, Mozilla/Firefox is around 1% and Opera less than 1%. I know IE is not the best browser around, but surely at least for the next 5 years it is the main one to be concerned about if your site is meant to appeal to a representative cross section of world wide web visitors.

_____________________________

:)

I have a higher and grander standard of principle than George Washington. He could not lie; I can, but I won't.
Samuel Clemens

(in reply to gorilla)
gorilla

 

Posts: 2974
From: Denmark
Status: offline

 
RE: @import question - 5/1/2004 8:48:02   
@ import is useful if you do have to cater for NN4.7x or indeed other version 4 browsers but don't want to code down to them exclusively. IOW you want more advanced browsers to take advantage of better css support but still want NN4.xx to see some styles.

This is all situation dependent.

Take an extreme example:

I'm kind of known for suggesting that people go for css layout and code to standards but I'm doing a freeby for a FRG at the moment that needs to be coded down to NN4.78.

I could do @ import but it is important that it looks identical to everybody irrespective of what they are using.

This is because a lot of the people using it are going to be military personnel and their families. A further complication is that my POC is a new frontpage user (FP 2000) who is a very busy person. Even busier than I am. She has one of the toughest jobs ever, running a family, and needs to be able to update it easily NOW so ...

I went originally for all css layout, it looked like hell in NN4.78 and wild horse won't get me to describe what it looked like in IE4. So I tossed the whole thing out and went for tables.

Pity really, but all these things are tools, so you reach for the one that works.

_____________________________

Mháircaish

Signature self-censored to protect the sensibilities of the thin-skinned :).

May we never confuse honest dissent with disloyal subversion. – Dwight D. Eisenhower



(in reply to Donkey)
d a v e

 

Posts: 4136
Joined: 7/24/2002
From: England (but live in Finland now)
Status: offline

 
RE: @import question - 5/1/2004 10:46:57   
i *think* that @import is useful if you want to add supplementary stylesheets e.g you have a main coprorate stylesheet business.css, then for a practicular department you might want it to follow all the main rules for layout and font choice but you want it on a different colour background and the links to be green - then you can import a second sheet to append the styles in the main one, either adding to or modifying existing styles, and the second sheet has a higher specifity for any given rule of the same potential weight weight because of the cascade.

I don't know but i don't think you can do this with linked styles, but i'm not sure at all.
maybe Mháircaish can clarify?

_____________________________

David Prescott
Gekko web design

(in reply to gorilla)
d a v e

 

Posts: 4136
Joined: 7/24/2002
From: England (but live in Finland now)
Status: offline

 
RE: @import question - 5/1/2004 10:50:12   
i *think* that @import is useful if you want to add supplementary stylesheets e.g you have a main coprorate stylesheet business.css, then for a practicular department you might want it to follow all the main rules for layout and font choice but you want it on a different colour background and the links to be green - then you can import a second sheet to append the styles in the main one, either adding to or modifying existing styles, and the second sheet has a higher specifity for any given rule of the same potential weight weight because of the cascade.

I don't know but i don't think you can do this with linked styles, but i'm not sure at all.
maybe Mháircaish can clarify?

_____________________________

David Prescott
Gekko web design

(in reply to gorilla)
Donkey

 

Posts: 3887
Joined: 11/13/2001
From: Blackfield United Kingdom
Status: offline

 
RE: @import question - 5/1/2004 12:57:46   
Dave, I'm sure that you are right, I was just making the point that if you want to have 2 stylesheets one for IE and one for the rest, you don't have to use @import in that case.

_____________________________

:)

I have a higher and grander standard of principle than George Washington. He could not lie; I can, but I won't.
Samuel Clemens

(in reply to d a v e)
d a v e

 

Posts: 4136
Joined: 7/24/2002
From: England (but live in Finland now)
Status: offline

 
RE: @import question - 5/1/2004 13:11:13   
no you don't need to. i usually just use the link method anyway.

_____________________________

David Prescott
Gekko web design

(in reply to Donkey)
gorilla

 

Posts: 2974
From: Denmark
Status: offline

 
RE: @import question - 5/1/2004 17:11:56   
Actually both of you are correct. One can do it with both but @import is useful for merging them, the basics for primitive browsers and link for more modern ones. One disadvantage to @import btw is that it sometimes, very rarely, leads to the FOUC bug. Where the visitor sees the unstyled page first - a second or less - then slam the styles are applied. It mostly occurs on overloaded machines with way to nuch in their cache. I personally have never been able to replicate it and believe me I tried.

I have seen it - and most CSS writers decry it because they say it puts clients and visitors off. I can only say that I saw the opposite reaction - they actually could see something was going on and were thrilled to bits. There's no accounting for taste :)

_____________________________

Mháircaish

Signature self-censored to protect the sensibilities of the thin-skinned :).

May we never confuse honest dissent with disloyal subversion. – Dwight D. Eisenhower



(in reply to d a v e)
Page:   [1]

All Forums >> Web Development >> Cascading Style Sheets >> @import question
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts