Style sheets break with TITLE attribute on <link> tags?

我们两清 提交于 2019-12-04 02:49:51

This appears to be expected behavior. From, for example, the MDN docs

A preferred stylesheet [...] is one that has a value of stylesheet supplied for the rel attribute, and any value at all for the title attribute. Here are two examples:

<link type="text/css" rel="stylesheet" title="Basic styles" href="basic.css" />
<link type="text/css" rel="stylesheet" title="Fish and boats" href="ocean.css" />

According to the HTML 4.01 specification, only one of the preferred stylesheets can be used at a time. Therefore, given the above example, only one of the two preferred stylesheets will be applied to the document. The specification does not supply a procedure to decide which one should be used, so user agents are free to make whatever choice they like.

From the spec

The title attribute gives the title of the link. With one exception, it is purely advisory. The value is text. The exception is for style sheet links, where the title attribute defines alternative style sheet sets.

Browsers can (I don't know of any that do any more, but extensions are available) provide a UI to allow the user to switch between different stylesheets supplied by the author for a page.

The title attribute is used to group the stylesheets for selection (and provide the label for them).

The first stylesheet encountered will be used to determine which group is used by default.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!