rel="alternate stylesheet" HTML attribute value

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

The alternate stylesheet keyword pair, when used as a value for the rel attribute of the <link> element, indicates that the target resource is an alternative style sheet. Specifying alternative style sheets in a web page allows users to see multiple versions of a page based on their needs or preferences.

Note: This feature is not well supported in browsers without an extension. To offer alternative presentations that work with a user's existing preferences, see the CSS media features prefers-color-scheme and prefers-contrast.

Firefox lets users select alternate stylesheets using the View > Page Style submenu, which displays the values of the title attributes. Other browsers require an extension to enable this functionality. The web page can also provide its own user interface to let users switch styles.

Examples

Specifying alternate stylesheets

Alternate stylesheets are specified using <link> elements with rel="alternate stylesheet" and title="…" attributes. For example:

html
<link href="reset.css" rel="stylesheet" />

<link href="default.css" rel="stylesheet" title="Default Style" />
<link href="fancy.css" rel="alternate stylesheet" title="Fancy" />
<link href="basic.css" rel="alternate stylesheet" title="Basic" />

In this example, the styles "Default Style", "Fancy", and "Basic" will be listed in the Firefox Page Style submenu with "Default Style" pre-selected. When the user selects a different style, the page will immediately be re-rendered using that style sheet.

No matter what style is selected, the rules from the reset.css stylesheet will always be applied.

Try it out

Try a working example here.

Details

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

  • Persistent (has rel="stylesheet", no title=""): always applies to the document.
  • Preferred (has rel="stylesheet", 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.
  • Alternate (rel="alternate stylesheet", with title="…" specified): disabled by default, can be selected.

In cases where a stylesheet menu exists, 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.

Use rel="stylesheet" to link to the default style, and rel="alternate stylesheet" to link to alternative style sheets. This tells the browser which style sheet title should be selected by default, and makes that default selection apply in browsers that do not support alternate style sheets.

Specifications

Specification
HTML
# rel-alternate
HTML
# the-link-is-an-alternative-stylesheet
HTML
# attr-style-title
HTML
# attr-meta-http-equiv-default-style
CSS Object Model (CSSOM)
# css-style-sheet-collections

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
rel="alternate stylesheet"
Chrome – No support
Chrome 1 – 47 (Release date: 2008-12-11)
footnote Removed in 48 and later
Edge – No support
Edge
footnote No support
Firefox – Full support
Firefox 3 (Release date: 2008-06-17)
footnote Full support
Opera – No support
Opera 15 – 34 (Release date: 2013-07-02)
footnote Removed in 35 and later
Safari – No support
Safari
footnote No support
Chrome Android – No support
Chrome Android 18 – 47 (Release date: 2012-06-27)
footnote Removed in 48 and later
Firefox for Android – Full support
Firefox for Android 4 (Release date: 2011-03-29)
footnote Full support
Opera Android – No support
Opera Android 14 – 34 (Release date: 2013-05-21)
footnote Removed in 35 and later
Safari on iOS – No support
Safari on iOS
footnote No support
Samsung Internet – No support
Samsung Internet 1 – 4.2 (Release date: 2013-04-27)
footnote Removed in 5 and later
WebView Android – No support
WebView Android 4.4 – 47 (Release date: 2013-12-09)
footnote Removed in 48 and later
WebView on iOS – No support
WebView on iOS
footnote No support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support

See also