Type and rel attribute


#1

please whio can explain to me what are type and rel attributes in css


#2

The type attribute describes the MIME Type. What sort of media is the resource?

type="text/css"

The above tells the browser to expect plain text media that conforms to CSS specifications.

The rel attribute conveys to the browser what sort of relationship the resource has to document.

rel="stylesheet"

#3

Hi, mtf. I understand that the “text/css” type conveys the use of plain text media, but isn’t it redundant to require a rel value, when the linked file value specified in the href attribute is a .css file? Are there other possibilities of a rel value, other than “stylesheet”, when a .css file is used? Maybe I’m getting ahead of myself and it will be further explained. Thanks for the help!


#4

https://www.w3.org/TR/html5/links.html

Note the list of types which is not to be confused with MIME Type, but relationship type. The one thing that all have in common is that a link must be created for the keyword.

<link rel="alternate" href="//example.com/text_alternate.html">

<link rel="prev" href="/feature/page_4.html" title="Page 4 (prev)">
<link rel="next" href="/feature/page_6.html" title="Page 6 (next)">

#5

Perfect - thanks for the info. That’s exactly what I wanted to know.


#6

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.