Congratulations to AcaCandy on her 100,000th post!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
acer black screen blue screen boot bsod computer connection crash css dell driver drivers email error ethernet excel firefox firefox 3 hard drive internet internet explorer itunes laptop linux malware monitor motherboard network networking outlook outlook 2003 outlook 2007 outlook express partition password printer problem router slow software sound spyware trojan usb video virus vista windows windows xp wireless
Web Design & Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
Solved: Linked vs. Imported Style Sheets


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
smooth's Avatar
Distinguished Member with 3,513 posts.
 
Join Date: Sep 2005
Location: NC, USA
Experience: Learning everyday :)
22-Nov-2005, 11:48 AM #1
Solved: Linked vs. Imported Style Sheets
Hello again,

I love using CSS for websites. It makes editing sites so much better, since I don't have to edit everything on each and every page.

That being said, I've noticed there are different ways of attaching a style sheet to a page. What are the differences?

The two I know of are linking and importing. What are the differences? Any advantages of one over the other? Any different uses between the two?

Thanks.
__________________

Meet Your Fellow TSG Members :: Find Out What CWLMST Means :: NCAA Football :: NCAA Basketball


Looking forward to meeting you up in heaven angel

I don't care how bad I feel, when I go to work I make sure I give it my all! Never any less than 12%...

47.5% of all statistics are made up right on the spot

When something is done in ignorance, then its always best to admit that you have no excuse, fix the problem, put it behind you, and move on - valley
OldRS's Avatar
Senior Member with 755 posts.
 
Join Date: Nov 2005
Location: USA
Experience: Intermediate
25-Nov-2005, 02:33 AM #2
There are actually three ways you can use CSS.
  1. In-line - part of the HTML tag
  2. In the header of the page
  3. In a separate file that is imported
The precedence is in the reverse order shown above, e.g., the In-line CSS will over ride the other two and the Header CSS will over ride the imported CSS. To get the full advantage of CSS, you need to put your definitions in a separate file and import it into all your HTML pages. Hope this helps.
smooth's Avatar
Distinguished Member with 3,513 posts.
 
Join Date: Sep 2005
Location: NC, USA
Experience: Learning everyday :)
25-Nov-2005, 09:55 AM #3
Thanks for the reply.

Yeah, I understand the in-line, in the header and such as that. I meant there are two ways you can use a external style sheet, and then bring it into the html.

I want to know what the difference between using import and using link when bringing in a external style sheet is. I've always just linked my external style sheets.
__________________

Meet Your Fellow TSG Members :: Find Out What CWLMST Means :: NCAA Football :: NCAA Basketball


Looking forward to meeting you up in heaven angel

I don't care how bad I feel, when I go to work I make sure I give it my all! Never any less than 12%...

47.5% of all statistics are made up right on the spot

When something is done in ignorance, then its always best to admit that you have no excuse, fix the problem, put it behind you, and move on - valley
erick295's Avatar
Distinguished Member with 2,156 posts.
 
Join Date: Mar 2005
Location: Atlanta, GA
Experience: Advanced
25-Nov-2005, 05:32 PM #4
Linking applies a single style sheet to the entire page.

@import just inserts the text in an external file into your document, so you can apply different styles to different areas. That doesn't work with Netscape 4 though.
ptvGuy's Avatar
Member with 78 posts.
 
Join Date: Apr 2004
Location: Far Northern California
Experience: Advanced
25-Nov-2005, 08:36 PM #5
The basic difference (and erick295 pretty much nailed it) is that @import allows your link to remain invisible to older browsers (primarily Netscape 4.x) while working in newer browsers. Older browsers will ignore them like a comment line which results in a page with default styling as set by that browser (generally very ugly) but no annoying error message. The link method will work fine in newer browsers but will give error messages (or other unexpected results) in older browsers.

With that said, since none of the websites I maintain has any significant traffic (generally less than 1%) from any 4.x or lower browser versions, I just stopped worrying about or supporting it. I now stick to the link method and I've even been including CSS2. (CSS3 is still unsupported by at least 50% of the traffic I see.) Hope this helps.
__________________
-->ptvGuy (http://www.ptvguy.com/)

KISS (Keep It Simple Stupid)
---------------------------
"It is the express duty of all ampersands to escape. All non-escaped ampersands will be hunted down, deleted, and replaced with escaped ampersands. Have I made myself clear, coder!!!"
OldRS's Avatar
Senior Member with 755 posts.
 
Join Date: Nov 2005
Location: USA
Experience: Intermediate
25-Nov-2005, 09:56 PM #6
Sorry, I misunderstood the question . Luckily, erick295 and ptvGuy caught on and provided very good explanations.
smooth's Avatar
Distinguished Member with 3,513 posts.
 
Join Date: Sep 2005
Location: NC, USA
Experience: Learning everyday :)
26-Nov-2005, 12:44 AM #7
Thanks.
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 11:41 PM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.