Look in the tag documentation of <h:outputStylesheet>
. It indeed doesn't list target
attribute. Perhaps you're confusing with the one from <h:outputScript>
.
The <h:outputStylesheet>
is by default always relocated to HTML <head>
, for the very simple reason because it's illegal to have a <style>
or <link>
element inside the HTML <body>
. The <h:outputScript>
however is by default located at exactly the same location as where it's been declared. The <script>
element as generated by it may be placed anywhere in the HTML <head>
or <body>
. You can let JSF auto-relocate this by setting the target
attribute to head
(will then appear in <head>
) or body
(will then appear in end of <body>
).
Just remove it. If target="body"
would theoretically have worked, it would only end up in illegal HTML output anyway.
<h:outputStylesheet library="css" name="style.css" />
Unrelated to the concrete problem, a resource library name of "css" is semantically wrong. Put it in the resource name.
<h:outputStylesheet name="css/style.css" />