Reputation: 339
Is the following markup valid?
<!DOCTYPE html>
<html>
<head>
<title>Test whether at-rules are valid in style attributes</title>
</head>
<body style="@import url(style.css);"></body>
</html>
Firefox and Chromium on Linux don't render it, but the W3C validator did not mark it as an error.
Upvotes: 3
Views: 476
Reputation: 6809
It is not.
@
-rules can't contain rules directly, but only selectors.
@import
imports a file, but they can't have rules outside selectors. @media
can only contain selectors. @font-face
doesn't affect elements. The style
attribute is meant for setting rules directly to elements, so clearly the @
-rules don't fit to that.
Upvotes: 2
Reputation: 943163
No.
Only a declaration may be placed inside a style attribute.
From the HTML 4.01 specification:
The syntax of the value of the style attribute is determined by the default style sheet language. For example, for [[CSS2]] inline style, use the declaration block syntax described in section 4.1.8 (without curly brace delimiters).
Upvotes: 3