No announcement yet.

Stylesheets: @import vs. linking

  • Filter
  • Time
  • Show
Clear All
new posts

  • Stylesheets: @import vs. linking

    Can someone explain the difference between linking a stylesheet using a <link> tag and using @import?

    I have a blog which has its own stylesheet, but it also borrows from a couple other sheets. The person who helped me (and whom I can't contact anymore) used the @import to reference the other sheets. I have copied all the text from each of the referenced sheets into the linked sheet, but when I've tried to disable the @import (or comment out the <style> tags in which the @import lives), the page doesn't display properly, even though all the necessary style information is contained in the linked stylesheet.

    When do you use one over the other, and why would you need to use both at the same time?

    I'm a little confused and would appreciate any guidance.


  • #2
    The only real benefit to @import is that you can hide stylesheet settings from older browsers that don't support it. If your site isn't working with all the stylesheet information locally, you need to review that information and make sure it is correct. Make sure the media type is setup properly and that the imported stylesheets do not do imports of their own.
    Translations provided by Google.

    Wayne Luke
    The Rabid Badger - a vBulletin Cloud demonstration site.
    vBulletin 5 API


    widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.