1 reply [Last post]
AE
AE's picture
Offline
newbie
Last seen: 18 years 32 weeks ago
Timezone: GMT+2
Joined: 2004-02-26
Posts: 9
Points: 0

"@import" and "link rel..."?

Aren't they both refering to an external stylesheet?

Which one's best to use?

co2
co2's picture
Offline
Leader
UK
Last seen: 14 years 25 weeks ago
UK
Joined: 2003-09-17
Posts: 721
Points: 0

So what exactly is the difference between....

@import's primary difference is that it is placed within the <style> tag itself (must come before all other styles for it to work). Additionally, it cannot be used as alternative stylesheets if more than one occurs in the <style> tag (i.e. all styles from the imported CSS file it specifies will be loaded regardless).

However, one of the main reasons to use it recently, is to filter out older browsers. Many older browsers simply do not understand the @import, therefore its a surefire and valid way to direct styles to more modern browsers, and not the older ones (such as NS4 etc.)

Smile

The next sentence is true. The previous sentence is false. Discuss...