I am working on an eclipse project using Spring, JSP, PrimeFaces 6.2, and bootstrap 3.37.
I have two boxes, one of which correctly has the CSS applied, the other does not.
I have some specific css styles in override.css. It targets the custom class tag I am using, and then changes the background colour.
.mytag
{
background-color: rgb(255,204,204);
}
My page construction looks like this
- head - loads a sub-folder header page
- body - loads form pages
- footer
<h:head>
<title>#{text['form.title']}</title>
<h:outputStylesheet library="css" name="form.css"/>
<h:outputScript library="js" name="form.js"/>
<h:outputStylesheet library="css" name="override.css" />
</h:head>
The only CSS that is applied in the file is the "mytag" but as displayed below many more are being auto-inserted.
header css tags
ui-inputfield ui-inputtext ui-widget ui-state-default ui-corner-all mytag
not header css tags
ui-inputfield ui-inputtext ui-widget ui-state-default ui-corner-all mytag
When I use the F12 Developer Tools for IE (its an IE specific site/application) and look at the styles, from highest to lowest I see for the one that does not work
- form.css
span.if .ui-inputfield, div.if .ui-inputfield
- components.css
.ui-widget-header .ui-inputfield, .ui-widget-content .ui-inputfield
- theme.css
.ui-inputfield, .ui-widget-content .ui-inputfield, .ui-widget-header .ui-inputfield
- (background) theme.css
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default
- theme.css
.ui-widget .ui-widget
- form.css
.ui-widget, .ui-widget .ui-widget
- (background) theme.css
.ui-inputfield, .ui-widget-content .ui-inputfield, .ui-widget-header .ui-inputfield
- theme.css
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default
- theme.css
.ui-widget .ui-widget
- theme.css
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button
- theme.css
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button
- components.css
.ui-inputfield
- override.css
.mytag
Here is the style list for the one that does work
- forms.css
span.if .ui-inputfield, div.if .ui-inputfield
- componets.css
.ui-inputfield
- override.css
.mytag
So both boxes have the same code section applying the CSS, so the ordering should be the same. Yet I find that "form.css" and "components.css" consistently have higher prioirty than my override, regardless of how I order them in the header. Its worse for the box that isnt working because the "theme.css" is being applied automatically.
Note: I originally thought it was the bootstrap.theme.css, but another question/answer has lead me to believe that it is actually primefaces theme. <h:outputStylesheet library="primefaces-aristo" name="theme.css" />
Solutions I have tried