What are all the available settings for stylesheet <link> elements?

When deploying CSS stylesheet <link> elements, what are all the available settings?

A persistent stylesheet looks like this:

<link rel="stylesheet" href="/my-stylesheet.css" />

I think the following settings are correct:

  1. including a title makes the stylesheet preferred
  2. including a title and rel="alternate stylesheet" makes the stylesheet alternate
  3. any stylesheet with a title is combined (turned on/off) with all others with the same title
  4. any stylesheet with a media attribute is media-specific and only applies when the media query condition is satisfied

I suspect there may be other settings I have missed out, alongside:

  • persistent
  • preferred
  • alternate
  • combined
  • media-specific

What are all the available settings for stylesheet <link> elements?

  • I still worry that this is very broad. I have no idea how long the list of "all the settings" is. Usually questions that ask for a big list can't be answered in a few paragraphs. I've reopened it for now. – Stephen Ostermiller Apr 25 at 23:20
  • A simple perusal of the HTML standard answers this question. – Rob Apr 26 at 10:46
  • @Rob - I see nothing in the document section you have linked to (or anywhere in the wider document) that discusses the settings (persistent, preferred, alternate, combined etc.) for <link rel="stylesheet">. Trust me, I wouldn't have posted the question above if I hadn't spent hours scouring the web first. What answer did you glean from your simple perusal of the WHAT-WG document you linked to? – Rounin Apr 26 at 12:07
  • You need to follow the links in the specification. For example, rel points to "allowed keywords" which contains some of your list. – Rob Apr 26 at 12:36
  • Note: the <link> tag does not use and does not need a closing slash and never has in HTML. – Rob Apr 26 at 12:40

MDN has an authoritative summary of stylesheet <link> settings here:


I'm not sure how I missed that - MDN is usually one of my first ports of call.


Any stylesheet in a document falls into one of the following categories:

  • Persistent (no rel="alternate", no title=""): always applies to the document.
  • Preferred (no rel="alternate", with title="..." specified): applied by default, but disabled if an alternate stylesheet is selected. There can only be one preferred stylesheet, so providing stylesheets with different title attributes will cause some of them to be ignored. See Correctly Using Titles With External Stylesheets for a more detailed discussion.
  • Alternate (rel="alternate stylesheet", title="..." must be specified): disabled by default, can be selected.

When style sheets are referenced with a title attribute on the <link rel="stylesheet"> or <style> element, the title becomes one of the choices offered to the user. Style sheets linked with the same title are part of the same choice. Style sheets linked without a title attribute are always applied.

Source: https://developer.mozilla.org/en-US/docs/Web/CSS/Alternative_style_sheets

The above doesn't go into media-specific, but it is the authoritative confirmation I was looking for.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.