1

Why most developers use the

<link href="/js/jquery-ui/css/flick/jquery-ui-1.8.23.custom.css" type="text/css" />
<link href="/css/main.css" type="text/css" />
<link href="/css/table.css" type="text/css" />

instead of

<style type="text/css">
 @import "/js/jquery-ui/css/flick/jquery-ui-1.8.23.custom.css";
 @import "/css/main.css";
 @import "/css/tables.css";
</style>

even in autogenrated code in html markup ? What is disadvantages of last method ?

asked Nov 14, 2012 at 9:50
5
  • i think stackoverflow.com/questions/1022695/… should help you. Commented Nov 14, 2012 at 9:52
  • you can read this Commented Nov 14, 2012 at 9:53
  • You'll get the detailed information of why not to use @import and use <link /> for linking stylesheets to the page here : stevesouders.com/blog/2009/04/09/dont-use-import Commented Nov 14, 2012 at 9:54
  • ok, from explanation i understand, that i can use @import in my project, but yes, that need some thinking when using it. Commented Nov 14, 2012 at 10:08
  • @eicto stick to normal approach... Commented Nov 14, 2012 at 10:11

2 Answers 2

3

Below are the few disadvantages that I know

  • Old browsers doesn't support @import
  • We can not take advantage of rel and title attributes with @import where we can take advantage of those attributes
  • link method is known as its simplicity

In order to learn more disadvantages with @import please go through http://www.stevesouders.com/blog/2009/04/09/dont-use-import/

answered Nov 14, 2012 at 9:59
Sign up to request clarification or add additional context in comments.

Comments

1

The biggest disadvantage is that CSS @import loads every CSS file seperately instead of loading files at once. This means the browser has to wait for every single imported CSS file to finish loading until it can start loading the next one. This slows down your website significantly, especially if you have a lot of imported CSS files.

answered Nov 12, 2014 at 15:41

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.