Forum Moderators: not2easy

Message Too Old, No Replies

@import

@import

         

ortem

5:32 pm on Sep 3, 2005 (gmt 0)

10+ Year Member



I have noticed that many sites are using "@import" with their CSS.

What relevance does this have and in what case woudl one apply it? Would anyone have any helpful links on the subject?

Thank you!

zackattack

6:02 pm on Sep 3, 2005 (gmt 0)

10+ Year Member



Hi Ortem

@import is not recognised by NN4, so can be useful if you want to deliver complex styling to more modern browsers that can handle it

Another use - Management

For example if you wanted to you could seperate your css out like so:
mainstyles.css - main layout css
forms.css - styles for forms etc
fixes.css - any hacks etc needed

all imported into one css file called 'screen.css' like so:

@import url("master.css");
@import url("forms.css");
@import url("fixes.css");

Then in your HTML you link to the one screen.css

In your HTML you link to 'screen.css' like so:

<link href="stylesheets/screen.css" rel="stylesheet" type="text/css">

With this example you can see it makes managing your styles SO much easier, its a personal preference of course.

Following this example above you may want to just seperate out the colour scheme for your website into a different file, and or if you are working with more than one person on a project you can seperate out sections of Styling

Well I wont go on, I am sure you get the idea

ZA

LInks wise there is lots out there about this, just google '@import and attaching style sheets'

moltar

6:25 pm on Sep 3, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



On another side the downside of having many extra files is the overhead added by HTTP requests.

ortem

2:14 am on Sep 4, 2005 (gmt 0)

10+ Year Member



That was extreemly helpful.

Thanks!