W3C home > Mailing lists > Public > public-css-archive@w3.org > March 2019

Re: [csswg-drafts] [selectors] Styling Content in <img> Elements (#3730)

From: TUSF via GitHub <sysbot+gh@w3.org>
Date: Thu, 14 Mar 2019 22:17:12 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-473086891-1552601831-sysbot+gh@w3.org>
A couple considerations:

* Having a Selector (like `>>`) would make it easy on Authors to apply styling to content defined in the document tree (an `<img>` or `<iframe>`), but any such image defined within CSS would require a different approach.
* Thoughts on this working on images created by [`element()`](https://drafts.csswg.org/css-images-4/#element-notation)?

Instead of a new selector, it may be more orderly to have all selectors aimed at images within an `@embed` at-rule (or `@image`?). Something like:
```CSS
@embed <selector> {
  <rule-list>
}
```
Where any `<img>` or `<iframe>` matching the selector has the <rule-list> applied to it. An example:
```CSS
@embed #mysvg {
  g.bg path {
    stroke: white;
  }
}
```

Here, any rules defined within the at-rule are applied to the image context matching the `#mysvg` selector. This can be extended by giving `@embed` properties, such as a name (if the selector is excluded), that can be applied to url/image functions by passing the at-rule's name.

-- 
GitHub Notification of comment by TUSF
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3730#issuecomment-473086891 using your GitHub account
Received on Thursday, 14 March 2019 22:17:13 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 19 October 2021 01:31:05 UTC