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.
|
|
|
|
|
![]() |
||
Linking to an external style sheet
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
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? |
|
|
|
#2
|
|||
|
|||
|
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" />
Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
|
|
#3
|
|||
|
|||
|
What i am supposed to do with that, i need som explanation dude?
|
|
#4
|
|||
|
|||
|
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.
Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
Last edited by moojoo; Aug 30th, 2006 at 15:26. |
|
#5
|
||||
|
||||
|
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)
|
|
#6
|
|||
|
|||
|
Re: Linking to an external style sheet
Quote:
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. |
|
#7
|
|||
|
|||
|
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....
Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
Last edited by moojoo; Aug 31st, 2006 at 13:26. |
![]() |
| Tags |
| linking, external, style, sheet |
| Thread Tools | |
|
|
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 |