What is the difference between the alternative style set and the preferred one? The question concerns the link element with the attribute rel="stylesheet" . It is clear that adding the title attribute seems to create another preferred set of styles. But how does this differ from the same rel="alternate stylesheet" ? There you can also add the title attribute. Essentially, this and that, just additional style sets? What then is the value of alternate ?

 <!-- a persistent style sheet --> <link rel="stylesheet" href="default.css"> <!-- the preferred alternate style sheet --> <link rel="stylesheet" href="green.css" title="Green styles"> <!-- some alternate style sheets --> <link rel="alternate stylesheet" href="contrast.css" title="High contrast"> 

    1 answer 1

    There are three types: constant, preferred or alternative table:

    1. Authors may specify a series of mutually exclusive style sheets called alternatives . Users can select tables that they like best. For example, the author can specify one style for small screens, another - for visually impaired users (for example, using a large font). User agents should provide users with the ability to select one of the alternative tables.
    2. The author may indicate that one of the alternatives is preferred . User agents should apply author-preferred stylesheets, unless the user has chosen a different alternative. Authors may group several alternative style sheets (including those preferred by the author) under the same style name. If the user selects a named style, the user agent must apply all style sheets with that name. User agents should not use alternative style sheets with a different style name. How to assign a name to a style group is described in the section on defining external style sheets.
    3. Authors may also specify permanent style sheets that user agents should use in addition to alternative style sheets.

    • For the table to be permanent, set the rel attribute to "stylesheet" , and do not set the title attribute.
    • To make the table preferred, set the rel attribute to "stylesheet" , and give the table a name using the title attribute.
    • To specify an alternative table, set the rel attribute to "alternate stylesheet" and give the table a name using the title attribute.

    More information .

    • Not no, just the opposite. The html5 specification says that the title attribute points to an alternative style sheet w3.org/TR/html5/document-metadata.html#attr-style-title Ie and rel = "alternate stylesheet" and "title" in the style element indicates an alternative style sheet? - Pavel Igorev
    • @PavelIgorev, details can be found in the specifications, of course, I quoted an excerpt from a human, even a working, description. - user207618
    • And where in the html5 specification is a description of an alternative and preferred style sheet? Or in some other described? These three types seem to be taken from html4, but is it outdated? - Pavel Igorev
    • @PavelIgorev, not everything that in 4-ke is by default obsolete, even more - much is transferred in a new, better way. - user207618
    • what is transferred is understandable. but in this case I consider this a flaw in the specification. description of preferred and alternative styles was not transferred to html5 (there is no description) - Pavel Igorev