<link> vs @import

D

don

I don't really see the difference between these two elements...... why would
you use one and not the other?
 
N

n|ck

don said:
I don't really see the difference between these two elements...... why would
you use one and not the other?

You can control (to some degree) which browsers load your .css file using
variations of the @import statement.
 
T

Toby Inkster

don said:
I don't really see the difference between these two elements...... why
would you use one and not the other?

<link> is an HTML element. It can be used to link your HTML document to
other URLs. These URLs can be related pages, style sheets and so forth.
@import is a CSS "at-rule". It can be used to import external style rules.
So <link> can be used for a whole bunch of different purposes, whereas
@import has only one purpose.

From a practical standpoint, @import is supported by less browsers than
<link rel=stylesheet>, so you can use it to hide stylesheets from older
browsers.
 
L

Lauri Raittila

I don't really see the difference between these two elements......

There is lots. For example, link is html and @import is CSS.
why would you use one and not the other?

If you want to import CSS from CSS, you use @import, if you want to link
stylesheet to html page, you use link.

You should also not that they are supported differently in browsers, but
that is usually not problem, unless your stylesheet breaks when external
style is not applied.
 
R

Richard

There is lots. For example, link is html and @import is CSS.


If you want to import CSS from CSS, you use @import, if you want to link
stylesheet to html page, you use link.

You should also not that they are supported differently in browsers, but
that is usually not problem, unless your stylesheet breaks when external
style is not applied.


Absolutely brilliant dr. watson.
It amazes me how your feeble brain works sometimes.
 
A

Andy Dingley

Absolutely brilliant dr. watson.
It amazes me how your feeble brain works sometimes.

From most people that would be obvious sarcasm, but for you -- well,
you really are just amazed, aren't you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top