Welcome Guest!
Please login
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.
![]() ![]() |
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? -------------------- |
|
|
Feb 16 2008, 05:12 AM
Post
#2
|
|
![]() Squeeze Machine ![]() 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. -------------------- |
|
|
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 -------------------- |
|
|
Feb 16 2008, 06:34 AM
Post
#4
|
|
![]() Squeeze Machine ![]() Posts: 560 Joined: 14-February 08 From: Stockport |
which one is best to use then?
-------------------- |
|
|
Feb 16 2008, 10:21 AM
Post
#5
|
|
![]() Rapid Squeezer ![]() 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 -------------------- |
|
|
Feb 16 2008, 11:52 AM
Post
#6
|
|
|
Master of the Universe ![]() 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. -------------------- |
|
|
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! |
|
|
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...
-------------------- |
|
|
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 |
|
|
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. |
|
|
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!
![]() ![]() |
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
Similar Topics
| Topic Title | Replies | Topic Starter | Views | Last Action | |||
|---|---|---|---|---|---|---|---|
![]() |
3 | Mark | 170 | 1st April 2008 - 08:47 AM Last post by: JustinStudios |
|||
![]() |
10 | unitedcraig | 300 | 18th April 2008 - 03:14 PM Last post by: paintingtheweb |
|||
![]() |
4 | Popje | 277 | 14th April 2008 - 10:51 AM Last post by: rewake |
|||
![]() |
10 | Popje | 560 | 2nd May 2008 - 06:10 PM Last post by: Popje |
|||
![]() |
6 | MikeHopley | 904 | 15th August 2008 - 10:54 AM Last post by: MikeHopley |
|||






Feb 16 2008, 04:11 AM















