Open Crissov opened 8 years ago
Why not just use CSS variable?
Over at the WHATWG issue, the original example was:
:root {--ThemeColor: meta("theme-color" color, "theme_color" color, #3F51B5);/* like attr() */}
That means, meta()
would be used with CSS Variables, but could also be used without them.
This ends up falling under the env()
function now, so I'm retagging this as a suggestion for new env() values.
While theme-color
could be added as a predefined environment variable, this issue is probably rather about CSS access to document-specific metadata, which can be divided into author-specified values (e. g. <title>
with a fixed key #3685 and <meta>
with possibly custom keys #2627 #2629 in HTML) and automatically derived properties (e. g. file size or date and protocol headers, e. g. HTTP). Some metadata that is available for the whole document may also be available for individual (e. g. title
from the closest ancestor title
attribute in HTML or description
from <desc>
child in SVG).
Like local element attributes with
attr()
, it would sometimes be handy to be able to access document-wide meta data, e.g. with HTML: