Jump to content


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


  • Please log in to reply
5 replies to this topic

#1 Guest_kilbad_*

Guest_kilbad_*
  • Guests

Posted 11 August 2006 - 10:18 PM

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

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 11 August 2006 - 10:25 PM

http://www.hwg.org/r...FAQ.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.
Legend has it that reading the manual never killed anyone.
My site

#3 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 12 August 2006 - 02:45 PM

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
Tell me the problem, I will try tell you the solution

#4 pixy

pixy
  • Members
  • PipPipPip
  • Advanced Member
  • 295 posts

Posted 12 August 2006 - 02:49 PM

I just do this:
<LINK REL="StyleSheet" HREF="style.css" TYPE="text/css" MEDIA="screen">

This is a .44 Caliber Loveletter straight through my heart.

Tabulas + Threadless + Hire Me!


#5 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 12 August 2006 - 03:14 PM

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
Tell me the problem, I will try tell you the solution

#6 pixy

pixy
  • Members
  • PipPipPip
  • Advanced Member
  • 295 posts

Posted 13 August 2006 - 01:31 AM

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
}

This is a .44 Caliber Loveletter straight through my heart.

Tabulas + Threadless + Hire Me!





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users