Linking to an external style sheet

This is a discussion on "Linking to an external style sheet" within the Web Page Design section. This forum, and the thread "Linking to an external style sheet are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Aug 30th, 2006, 14:58
Junior Member
Join Date: Aug 2006
Location: Jordan
Age: 22
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Smile Linking to an external style sheet

I'm learning about CSS in http://www.w3schools.com.
I have a question about linking pages to an external style sheet.

The site provided this syntax for linking and following are my questions,

<head>
<link rel="stylesheet" type="text/css"href="mystyle.css" />
</head>
First of all, I need to know what are the properties rel and type do exactly?
Secondly, the closing of the link tag /> is that XHTML?
Reply With Quote

  #2 (permalink)  
Old Aug 30th, 2006, 15:05
moojoo's Avatar
Moderator
Join Date: Aug 2005
Location: Texas
Age: 31
Posts: 1,604
Thanks: 0
Thanked 6 Times in 6 Posts
Send a message via AIM to moojoo Send a message via MSN to moojoo Send a message via Yahoo to moojoo
Re: Linking to an external style sheet

<link rel="stylesheet" title="Main CSS" href="foo.css" media="screen" type="text/css" />
<link rel="stylesheet" title="Print CSS" href="print.css" media="print" type="text/css" />
__________________
I've got <style> and .class
Reply With Quote
  #3 (permalink)  
Old Aug 30th, 2006, 15:17
Junior Member
Join Date: Aug 2006
Location: Jordan
Age: 22
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation Re: Linking to an external style sheet

What i am supposed to do with that, i need som explanation dude?
Reply With Quote
  #4 (permalink)  
Old Aug 30th, 2006, 15:23
moojoo's Avatar
Moderator
Join Date: Aug 2005
Location: Texas
Age: 31
Posts: 1,604
Thanks: 0
Thanked 6 Times in 6 Posts
Send a message via AIM to moojoo Send a message via MSN to moojoo Send a message via Yahoo to moojoo
Re: Linking to an external style sheet

Just ane xample of how to link to style sheets and assign different media types etc.. They would just go in the head of your document and point to your external css files. basically rel sets the type of file as does type. i.e. type ="text/javascript" or something. As for the /> it is XHTML and is a good thing so you could do say <img src="" alt="" width="" height="" /> vs doing <img></img>. Makes the code more streamlined and eliminates the need for additional closing tags.
__________________
I've got <style> and .class

Last edited by moojoo; Aug 30th, 2006 at 15:26.
Reply With Quote
  #5 (permalink)  
Old Aug 30th, 2006, 16:17
minute44's Avatar
Moderator
Join Date: Apr 2006
Location: Nottingham UK
Age: 24
Posts: 1,347
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to minute44
Re: Linking to an external style sheet

and you woul use Rel= if you were including some kind of style switcher. look on www.minutedesigns.com to see how I've done this.
Last Blog Entry: Annoying people.... (Jan 16th, 2008)
Reply With Quote
  #6 (permalink)  
Old Aug 30th, 2006, 19:33
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Skype™ to ukgeoff
Re: Linking to an external style sheet

Quote:
As for the /> it is XHTML and is a good thing so you could do say <img src="" alt="" width="" height="" /> vs doing <img></img>.
This is a little misleading. There never was a requirement for an </img>.

Some tags contained information between them, so called open tags, as in <p>This is a para</p>.

Others such as <b>, <img>, etc, so called close tags never had a partner tag. Everything was handled as attributes within the tag.

XHTML determines that every tag should have a closing indicator but in the case of previously closed tags, this is done by using the ' />' notation, as in <b />, <img... />, etc.

Note the space between the end of the tags content and the '/>'.

Last edited by ukgeoff; Aug 31st, 2006 at 13:40.
Reply With Quote
  #7 (permalink)  
Old Aug 31st, 2006, 13:23
moojoo's Avatar
Moderator
Join Date: Aug 2005
Location: Texas
Age: 31
Posts: 1,604
Thanks: 0
Thanked 6 Times in 6 Posts
Send a message via AIM to moojoo Send a message via MSN to moojoo Send a message via Yahoo to moojoo
Re: Linking to an external style sheet

It was just an example of opening and closing tags vs />. First thing that popped into my head. I can see how it could be confusing. Andf to elaborate as stated about style switching, you would do somethign like:

<link rel="stylesheet" title="Main CSS" href="foo.css" media="screen" type="text/css" />

then

<link rel="alternate stylesheet" title="Alt Main CSS" href="foo2.css" media="screen" type="text/css" />

etc....
__________________
I've got <style> and .class

Last edited by moojoo; Aug 31st, 2006 at 13:26.
Reply With Quote
Reply

Tags
linking, external, style, sheet

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding a style sheet to an RSS feed problem Andrew1986 Other Programming Languages 5 Feb 19th, 2008 10:31
Why Style sheet isnt working kaz Web Page Design 19 Dec 21st, 2007 01:10
CSS Print Style Sheet Problem bennyboy7 Web Page Design 1 Aug 14th, 2007 08:58
new to css: what's the best way to insert image using the external style sheet? mad samuel Web Page Design 14 Aug 10th, 2007 17:52
How to tell IE7 to use a pariticular style in a single style sheet figo2476 Web Page Design 5 May 25th, 2007 14:23


All times are GMT. The time now is 05:18.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43