Link tag


#1

In the link tag, what is the type, rel and href?
Please someone explain.


#2

type is no longer required to specify in html5. Anyway, MDN always has great documentation, also about <link>, href stands for hyperlink reference, which means href tells <link> where the css file is located


#3

Still do u know whats the type and rel?


#4

i provided a link to excellent documentation, read it, if you have any questions after that, i will answer them


#5

sorry i didnt notice the link earlier. Yep i read it now and its quite clear. So if rel is used state a relation btwn the external doc and the current one then can it be anything other than "stylesheet"? can it be "html"? or"txt"?


#6

the page you where on contain a link to a page about rel (you can find the page here), which list all possible values for rel, i don't see html or txt, why would you want to do that?


#7

Thanks I got the concept of rel now.
I was just curious if we could link up other formats if needed in future.
Sorry for the many questions but i dont understand when we write "text/css" in type, why do we write text/css and why not stylesheet/css?
Can we give it any random name/css?


#8

:smile:

no, we can use other tags for that, for example if we want to embed a txt file:

<object data="/path_to_text_file/text.txt" type="text/plain" style="height: 300px height: 500px">
<a href="/path_to_text_file/text.txt">No Support?</a>
</object>

or if you want to embed a html file:

<iframe src="page.html" width="300" height="300">
 <p>Your browser does not support iframes.</p>
</iframe>

type's values are fixed, certain things needs to be fixed, otherwise it would be such a mess. If things aren't fixed/standardized, your computer need to support all those values, that would be a disaster


#9

Got it Thanks a lot :+1: