How to change colour of a certain word in an HTML file in a Java code?
In the pre-existing code, the HTML file background colour has been set like this:
file+="<table width=\"95%\" align=\"center\" style=\"background : #"+
HTML_REPORT_COLOR_2+"; border : 1px solid #000000\">";
file+="Wrong colour for driver has been chosen . The correct tag is Green";
file+="<br/><br开发者_StackOverflow/>";
I want to change the wrong word which is presently in black to red. The right way to go about using the fonts tag, but how do I use it here, as this is a Java code. I tried feeding it to the file variable, but "#" is giving me an error.
Current
Wrap the word "Wrong" in a span tag, like this:
<span class="error">Wrong</span>
If you have access to the CSS of the document, add this declaration:
.error{
color: #FF0000;
}
If you don't have access to the CSS, make the span
element look like this, instead:
<span style="color: #FF0000;">Wrong</span>
Previous
If I'm correctly understanding what you're trying to do, you need to change the hexadecimal value of HTML_REPORT_COLOR_2
from 000000
or 000
to FF0000
or F00
.
That should be the solution, unless I'm mis-understanding your problem.
精彩评论