-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add sheet
attribute to the <link>
tag's for CSS @sheet
support
#11022
Comments
Notes from the WHATOT meeting: there is general support for this, once the
|
How about a "sheets" property, to reference one or more @sheets, which may be a common use case? <link rel="stylesheet" href="#inline_styles" sheets="resets card-styles" /> The sheet property would then still be available to directly reach the underlying CSSStyleSheet included from LinkStyle. |
What is the issue with the HTML Standard?
The problem
CSS
@sheet
allows for defining multiple stylesheets in one CSS file. The CSSWG initially resolved to using fragment identifiers for applying@sheet
definitions, but this solution will never work for same-document stylesheets. For context, here is an example of the original@sheet
proposal using external .css files:foo.css:
...and then in a separate HTML file:
This will not work for local style references because fragment identifier references must match the MIME type of the element referenced. This means that
@sheet
will never work for inline/same-document CSS, as demonstrated in this example:The
href
above is invalid, since the MIME type offoo
is CSS (due to it referencing an internal CSS identifier). This was discussed with the CSSWG at a recent F2F.Use cases
@sheet
with same-document sheet references@sheet
with Declarative Shadow DOM for same-document styleslayer
attribute on the<link>
tag proposed hereProposed Solution
Adding a
sheet
attribute to thelink
tag will solve these issues and allow for same-document style references. Here is an example with an external CSS file:foo.css:
In this example, the stylesheet associated with the
<link>
tag would contain the rules from the sheet "bar".Combined with #11019, CSS
@sheet
could work with locally defined CSS as follows:Prior Art
The text was updated successfully, but these errors were encountered: