PDA

View Full Version : @Import and <link>


ByteWizard
12-05-2002, 12:41 PM
I am having trouble finding a good explanation for the proper use of @Import vs <link>.

It seems that <link> is primarily for multiple style sheets chained together ??

@Import is primarily for the inclusion of a single style sheet file ??

Should <link> be within a style calling additional styles from an outside source?

Zero Angel
12-05-2002, 01:00 PM
<link> and @import seem to accomplish the exact same thing. But, I have noticed a strange bug within IE where CSS thats called using @import doesnt show up until the document is half rendered, giving the user an unpleasent surprise if the document uses a CSS layout.

This phenomenon is called 'FOUC' (Flash of Unstyled Content). You can read about it here (http://www.bluerobot.com/web/css/fouc.asp).

DCElliott
12-05-2002, 05:28 PM
@import was not understood by older browsers and could be used to hide CSS from them. That is the main reason to use it over <link>

ByteWizard
12-06-2002, 05:02 AM
@import has both a pro and a con; <link /> has neither

Can you explain further or tell me where to read. I have gone thru all the CSS syntax / tutorials I can find with little help.

ByteWizard
12-06-2002, 03:36 PM
Just as I was totally convinced to use @Import, I noticed the speed differential and had a tolerance limit of .0000025 . I just cant see compromising for .0000025 .

Still Confused

DCElliott
12-06-2002, 04:29 PM
I think we have just seen a PRO at CONning at work.:hahaha:

ByteWizard
12-07-2002, 06:06 AM
A JOKE !!!

I have been conned ???? :eek:

Seriously David, thanks for the insight. Do you always use @import?

DCElliott
12-07-2002, 06:17 AM
I have mostly used link, mostly because folks whose pages I desire to emulate have used it.

ByteWizard
12-10-2002, 04:44 PM
There are 3 ways to include a style sheet in your HTML code:
[list=1]
Embedded styles
Imported styles
Linked styles
[/list=1]

In terms of hierarchy, Embedded styles take precedent over both other types; Imported styles take precedent over Linked styles, making Linked styles at the bottom of the food chain.

The other thing to consider is that Netscape 4 does not support Import. This can be used to shield Netscape 4 from styles that are not compatible with that browser.

Zero Angel
12-10-2002, 05:08 PM
In terms of heirarchy, styles specified later in the document take precedence over styles specified earlier in the document.

But due to the standard order, link is often defined first, then @import, then embedded styles. In that case, what you said is still true.