6 replies [Last post]
KostaKondra
KostaKondra's picture
Offline
Enthusiast
Sydney
Last seen: 11 years 1 week ago
Sydney
Timezone: GMT+10
Joined: 2009-11-19
Posts: 68
Points: 87

<link href="style1.css" rel="stylesheet" type="text/css"/>

So you're linking to a style sheet style1.css which is in the same folder. What does 'rel' stand for, relationship? If you define the type as text/css why do you have to have rel in there? Is that just for different browsers who might not understand type?

Verschwindende
Verschwindende's picture
Offline
Guru
Last seen: 3 weeks 2 days ago
Timezone: GMT-4
Joined: 2009-10-09
Posts: 2050
Points: 2282

rel = link-types This

rel = link-types
This attribute describes the relationship from the current document to the anchor specified by the href attribute. The value of this attribute is a space-separated list of link types.

KostaKondra
KostaKondra's picture
Offline
Enthusiast
Sydney
Last seen: 11 years 1 week ago
Sydney
Timezone: GMT+10
Joined: 2009-11-19
Posts: 68
Points: 87

Type

So why do you need both type and rel? Doesn't type also state the relationship between the current page and the linked style sheet. It's basically the same thing. When would having two definitions ever be useful?

Cheers

Tyssen
Tyssen's picture
Offline
Moderator
Brisbane
Last seen: 6 years 50 weeks ago
Brisbane
Timezone: GMT+10
Joined: 2004-05-01
Posts: 8201
Points: 1386

The rel attribute is

The rel attribute is necessary because if you ever wanted to provide alternate stylesheets, the value of the rel attribute would be 'alternate stylesheet'.

How to get help
Post a link. If you can't post a link, jsFiddle it.
My blog | My older articles | CSS Reference

KostaKondra
KostaKondra's picture
Offline
Enthusiast
Sydney
Last seen: 11 years 1 week ago
Sydney
Timezone: GMT+10
Joined: 2009-11-19
Posts: 68
Points: 87

Difference?

What is the difference between a style sheet and an 'alternate style sheet' and what cases would you use either ones?

(i am going to get to the bottom of this)

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 30 weeks 10 hours ago
Dallas
Timezone: GMT-6
Joined: 2004-06-25
Posts: 9776
Points: 3858

When all else fails, rtfm.

When all else fails, rtfm. Wink

Seriously, it is a Good Thing® to become practiced at reading and understanding (as well as a normal human being can) the specs we work with.

See §14.3 External style sheets. You can specify, by declaring a relationship, that a given stylesheet, or group of stylesheets (using the title attribute) is preferred, persistent, alternate, or some combination.

cheers,

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.

Verschwindende
Verschwindende's picture
Offline
Guru
Last seen: 3 weeks 2 days ago
Timezone: GMT-4
Joined: 2009-10-09
Posts: 2050
Points: 2282

KostaKondra wrote: So why do

KostaKondra wrote:

So why do you need both type and rel? ...

Are you thinking they are the same thing because one says Stylesheet and the other says text/css?

type is the linked documents mime type and rel is it's relationship to the page. Two entirely different things. As you've seen by the other responses it isn't always rel="stylesheet".

I think you've been pointed to htmldog.com about 16 times so far, have you been there yet?