Welcome Guest!

If you do not have an account yet on The Web Squeeze forums, please Register! It’s FREE and there are many benefits:

  • Receive Fast Advice
  • Learn Programming Languages
  • Get Professional Website Reviews
  • Quick Troubleshooting Assistance

> Ways To Include Css Files

This is a discussion on Ways To Include Css Files, within the CSS section. This forum and the thread "Ways To Include Css Files" are both part of the Designing Your Website category.

 
Reply to this topicStart new topic
> Ways To Include Css Files
4lun
post Feb 16 2008, 04:11 AM
Post #1


Fresh Squeezed
**

Posts: 38
Joined: 14-February 08
From: Newport, S.Wales


Are the any differences between using:
CODE
<style type="text/css" media="all">@import url(http://www.thewebsqueeze.com/forum/style_images/css_5.css);</style>

and
CODE
<link rel="stylesheet" type="text/css" href="http://www.thewebsqueeze.com/forum/style_images/css_5.css" />

to include css files.

If so which one is better to use? scratch_one-s_head.gif


--------------------
View my: portfolio | flickr | last.fm
Go to the top of the page
 
+Quote Post
unitedcraig
post Feb 16 2008, 05:12 AM
Post #2


Squeeze Machine
Group Icon

Posts: 560
Joined: 14-February 08
From: Stockport


I just use the second, as do 99% of other sites.

I am not sure why people use the other one.


--------------------
Go to the top of the page
 
+Quote Post
welshstew
post Feb 16 2008, 06:03 AM
Post #3


Squeezing
***

Posts: 82
Joined: 14-February 08
From: inside the outside


this is another browser hack, earlier browsers do not understand the @import command, and therefore ignore it.

I think this might have been for browsers previous to version 4, so really it's not needed much these days, hence why 99.8% of people do not use it


--------------------
Go to the top of the page
 
+Quote Post
unitedcraig
post Feb 16 2008, 06:34 AM
Post #4


Squeeze Machine
Group Icon

Posts: 560
Joined: 14-February 08
From: Stockport


which one is best to use then?


--------------------
Go to the top of the page
 
+Quote Post
rewake
post Feb 16 2008, 10:21 AM
Post #5


Rapid Squeezer
Group Icon

Posts: 239
Joined: 14-February 08
From: NY, USA


Hey guys,

There is also the FOUC issue in IE while using @import, in which IE will show you a completely unstyled page momentarily.

Rich


--------------------
QUOTE
if ($name=='will') echo '/(bb|[^b]{2})/';

Raineri Jewelers | MySpace | Facebook | deviantART
Go to the top of the page
 
+Quote Post
Jason
post Feb 16 2008, 11:52 AM
Post #6


Master of the Universe
Group Icon

Posts: 1,298
Joined: 15-February 08
From: London, England


As others have said, The main difference is that early browsers do not support the import command. This is no longer a problem so there shouldn't be any difference between the two.

<link> is the most common way to link files.

Use whatever you prefer.


--------------------
Go to the top of the page
 
+Quote Post
Stuart
post Feb 18 2008, 10:48 AM
Post #7


Squeezing
***

Posts: 58
Joined: 13-February 08
From: Squeezin' at the juice bar


Seeing that all browsers understand and support both methods, you can use either one.

However, <link> is more common and preferred by most designers.


--------------------
Stuart :: Squeeze it up!

QUOTE
Macs can squeeze the juice out of Windows!

Go to the top of the page
 
+Quote Post
Daygon
post Feb 20 2008, 04:50 PM
Post #8


Rapid Squeezer
****

Posts: 120
Joined: 13-February 08
From: Houston, Texas


i prefer the second one cause thats the way i was taught and i know for a fact that it works across all the browsers and platforms...


--------------------
Jonathon Harrelson
Portfolio: InterAction Media Inc
Available for work
Go to the top of the page
 
+Quote Post
paintingtheweb
post Feb 22 2008, 01:16 PM
Post #9


Squeezing
***

Posts: 77
Joined: 14-February 08
From: Las Vegas, NV


As welshstew said, this is a browser hack. The main reason it is used (or should be used IMO) is if you're designing your site to be read by older browsers as well as new ones. Example:

CODE
<link rel="stylesheet" type="text/css" href="basic.css" />
<style>
@import "advanced.css";
</style>


where basic.css would contain color info and what not (you know, basic stuff) and advanced.css would contain the layout info (like floating, padding, etc...). Here's a nice little chart that kinda helps with knowing what browsers support what css commands: http://centricle.com/ref/css/filters/

This post has been edited by paintingtheweb: Feb 22 2008, 01:16 PM


--------------------
http://www.infoonmike.com

"Always program as if the person who will be maintaining your program is a violent psychopath that knows where you live." Martin Golding
Go to the top of the page
 
+Quote Post
thesealportaltea...
post Feb 22 2008, 01:27 PM
Post #10


Rapid Squeezer
****

Posts: 218
Joined: 14-February 08
From: Currently loacted in bustle of vurtual servers hosted by GoDaddy.com.


I think to answer the question on the difference.
I believe IE loads the import after the HTML content is loaded.
Thats why,
QUOTE
There is also the FOUC issue in IE while using @import, in which IE will show you a completely unstyled page momentarily.


I don't believe Firefox does it.


--------------------
We are sorry but complaint.hell is not registered to Heaven Inc.
TheSealPortal.com - Yea, we are celebrating are 200th post at TWS. Everybody Party.
Go to the top of the page
 
+Quote Post
If you found The Web Squeeze to be helpful, please donate so we can keep this site FREE, FRESH, and fortified with Web Design & Development info!
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No New Posts   3 Mark 170 1st April 2008 - 08:47 AM
Last post by: JustinStudios
No New Posts   10 unitedcraig 300 18th April 2008 - 03:14 PM
Last post by: paintingtheweb
No New Posts   4 Popje 277 14th April 2008 - 10:51 AM
Last post by: rewake
No New Posts   10 Popje 560 2nd May 2008 - 06:10 PM
Last post by: Popje
No New Posts   6 MikeHopley 904 15th August 2008 - 10:54 AM
Last post by: MikeHopley