Jump to content

Archived

This topic is now archived and is closed to further replies.

Guest kilbad

Why do people use @import 'another_css_file.css' ? Pro's and cons?

Recommended Posts

Guest kilbad
Why do people use @import 'another_css_file.css' in their main css file?  Why not just link to the other sheet in the page header?  Is there a benefit to doing it this way?

thanks! Brendan

Share this post


Link to post
Share on other sites
http://www.hwg.org/resources/faqs/cssFAQ.html#import

And older version of Netscrap couldn't understand @import and thus ignored it, allowing what amounts to a Netscrap-compatible style sheet plus imported styles for other browsers.

Share this post


Link to post
Share on other sites
and using @ in most programming languages (PHP C#....)
It stops errors being shown

@require("file.php");

If this fails, with the @, no error messages are shown to the browser

Share this post


Link to post
Share on other sites
I just do this:
<LINK REL="StyleSheet" HREF="style.css" TYPE="text/css" MEDIA="screen">

Share this post


Link to post
Share on other sites
I normally have something like this (well this exact, its copied from one my websites)

<link href="spaininland.css" rel="stylesheet" type="text/css" />
<!--[if IE]>
<link href="spaininlandie.css" rel="stylesheet" type="text/css" />
<![endif]-->

This sorts out some crap just for IE

Share this post


Link to post
Share on other sites
Yeah, I have to change some stuff for IE. I hate Internet Explorer.

I just do it in PHP:
if (strpos(strtoupper($_SERVER['HTTP_USER_AGENT']), 'MSIE') {
  // IE stuff
}
else {
  // FF stuff
}

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.