Good morning, i have a problem in applying a style sheet on a primefaces commandButton
, the button element is as follows:
<p:commandButton value="Complains" styleClass="styleOrange"/>
and the style sheet:
.styleOrange {
background-color: orange;
}
the css file is placed in the resources folder under css folder:
here's the include statement of the css file:
<h:head>
<h:outputStylesheet name="/resources/css/style.css" library="css" />
</h:head>
The @import rule allows you to import a style sheet into another style sheet. The @import rule must be at the top of the document (but after any @charset declaration). The @import rule also supports media queries, so you can allow the import to be media-dependent.
There is no way to "link a css file to a specific div". You can make the css in style. css apply only to a certain div using selectors, but your question, as stated, makes no sense.
Yes, It is possible to include one CSS file in another and it can be done multiple times. Also, import multiple CSS files in the main HTML file or in the main CSS file. It can be done by using @import keyword.
CSS can be added to HTML documents in 3 ways: Inline - by using the style attribute inside HTML elements. Internal - by using a <style> element in the <head> section. External - by using a <link> element to link to an external CSS file.
There is no need for the /resources/
prefix. JSF already implicitly loads resources from there.
Just change the name into css/style.css
, like this:
<h:outputStylesheet name="css/style.css" />
You should also read this What is the JSF resource library for and how should it be used?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With