<link>
Example
<link href="styles.css">
<link rel="shortcut icon" href="favicon.ico"><link rel="stylesheet" href="styles.css">
<link rel="icon" href="favicon.svg" type="image/svg+xml">Without rel the stylesheet is ignored, and rel='icon' is the standard keyword for favicons.
Common mistakes
- Leaving out
relor misspelling it, so the stylesheet silently does not load. - Loading many small render-blocking stylesheets that could be one file.
Key points
- Stylesheets use
rel='stylesheet'with anhref;type='text/css'is not needed. - Favicons use
rel='icon'with the righttype, andsizeswhen there are several. - Resource hints like
preloadandpreconnectare in<head>, so the browser sees them early.
Interview questions
Does a stylesheet link block rendering?
Yes, stylesheets in <head> block rendering until loaded. A media attribute limits that to the conditions where the styles apply.
Can I load CSS without blocking first render?
Yes, a stylesheet whose media does not match, such as 'print', is still downloaded but does not block first render.