0

I have many <pr:inputText> components in my xhtml, I want the color of all those texts to be blue. When I use

     <head>
 .ui-inputtext {
        color: blue;
    }
</head>

in head tag it works fine but it disturbs other functionality. when I use <h:head> tag for this css, it does not work. will you please help me know how to use css for inputText using standard jsf head tag

Ajmal Khan
  • 87
  • 1
  • 8

2 Answers2

0

Not sure why you put your css directly in the page.

Create a css file and in your <h:head> put this:

<h:head>
      <h:outputStylesheet library="css" name="styles.css"  /> 
   </h:head>

Update

If this does not override the default color then add !important lie this:

.ui-inputtext {
        color: blue !important;
    }
Maciej Kowalski
  • 25,605
  • 12
  • 54
  • 63
  • please help me to know solution. what should be class and what to be written inside class – Ajmal Khan Jan 25 '17 at 10:29
  • 1
    try with the updated solution – Maciej Kowalski Jan 25 '17 at 10:33
  • Thank you so much it is working fine now – Ajmal Khan Jan 25 '17 at 10:35
  • 1
    Great. glad it solved the problem. – Maciej Kowalski Jan 25 '17 at 10:38
  • `!important` is not the correct solution to this particular problem, but a workaround. You should recommend correct solutions over workarounds. – BalusC Jan 25 '17 at 14:20
  • 1
    The guy asking the question seemed to be satisfied, but i guess you cannot please everyone. – Maciej Kowalski Jan 25 '17 at 14:43
  • Indeed, Stack Overflow is intented as knowledge base for everyone, now and in the future. That's why it's so much better than such an old fashioned discussion forum where only askers are satisfied and therefore their posts are terribly useless for researchers looking for elaborate explanations and correct solutions. – BalusC Jan 25 '17 at 15:30
  • I get you mate. Sometimes though I am not aware that I have been using a solution which turns out to be considered a workaround. I think a down vote Is the right way of expressing such concerns. Thought that the additional comment was not necessary. That's all – Maciej Kowalski Jan 25 '17 at 15:53
-1

You can user jQuery selector as follow:

    $("input[type='text']").css({
color: blue;
})
Programmer Khan
  • 45
  • 1
  • 2
  • 10