/    Sign up×
Community /Pin to ProfileBookmark

Link versus import

Is there any difference in speed or effectiveness between these two ways of using an external stylesheet?

[code]<style type=”text/css”><!–@import”/style.css”;–></style>[/code][code]<link href=”/style.css” rel=”stylesheet” type=”text/css”>[/code]

to post a comment
CSS

5 Comments(s)

Copy linkTweet thisAlerts:
@ray326Sep 02.2005 — No speed difference, some filtering effect because old browsers don't understand @import so you can hide the "spiffy" stuff from them using that.
Copy linkTweet thisAlerts:
@KravvitzSep 02.2005 — If you want to do stylesheet switching, <link> is better.

I sometimes <link> a CSS file that @import's other CSS files to get the benefits of both.
Copy linkTweet thisAlerts:
@the_treeauthorSep 02.2005 — [b]Ray[/b]: What type of stuff would you want to hide from older browsers? I can only imagine what you'd want to hide from newer browsers (i.e. obselete hacks).
Copy linkTweet thisAlerts:
@KravvitzSep 02.2005 — I hope you don't mind my answering for you Ray.

In this case, he is referring to IE4 and NS4.

They don't fully support @import, so by using it you can hide CSS code from them.

http://www.dithered.com/css_filters/css_only/index.php

If you saw how IE4 and NS4 completely mangled a tableless layout before the CSS was hidden from them, you would understand why we do this.
Copy linkTweet thisAlerts:
@ray326Sep 02.2005 — I hope you don't mind my answering for you Ray.[/QUOTE]Not at all.
×

Success!

Help @the_tree spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...