-
table styling
is there a way to use table tr td to show different color textdepending on what the td has in it?
example:
<td>W</td> would show red text color(or any color of your choosing)<td>W</td>
and
<td>L</td> would show text color of blue(or any color of your choosing)<td>L</td>
there will be quite a few of each on a ldeger and instead of doing inline styling this would save me a bit of typing
Thanks in advance
-
You can't do it with CSS, but you can with JavaScript http://stackoverflow.com/questions/8...-cell-contents
-
You can change the background colour using CSS if that helps.
Mark up:
Code:
<tr class='yellow'><td>The Water Wheel Project</td><td>John Munday & John Parker</td><td>May 2015</td></tr>
<tr class='blue'><td>Race Night 2015</td><td>Rod Rayner</td><td>April 2015</td></tr>
CSS:
Code:
table tr.yellow td{
background: rgb(255,254,245); /* Old browsers */
background: -moz-linear-gradient(top, rgba(255,254,245,1) 0%, rgba(249,240,173,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,254,245,1)), color-stop(100%,rgba(249,240,173,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(255,254,245,1) 0%,rgba(249,240,173,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(255,254,245,1) 0%,rgba(249,240,173,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(255,254,245,1) 0%,rgba(249,240,173,1) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(255,254,245,1) 0%,rgba(249,240,173,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fffef5', endColorstr='#f9f0ad',GradientType=0 ); /* IE6-9 */
}
table tr.blue td{
background: rgb(245,251,255); /* Old browsers */
background: -moz-linear-gradient(top, rgba(245,251,255,1) 0%, rgba(219,241,255,1) 47%, rgba(191,230,255,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(245,251,255,1)), color-stop(47%,rgba(219,241,255,1)), color-stop(100%,rgba(191,230,255,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(245,251,255,1) 0%,rgba(219,241,255,1) 47%,rgba(191,230,255,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(245,251,255,1) 0%,rgba(219,241,255,1) 47%,rgba(191,230,255,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(245,251,255,1) 0%,rgba(219,241,255,1) 47%,rgba(191,230,255,1) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(245,251,255,1) 0%,rgba(219,241,255,1) 47%,rgba(191,230,255,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f5fbff', endColorstr='#bfe6ff',GradientType=0 ); /* IE6-9 */
}
The two smileys should be typed as a colon and uppercase D.
-
I used the least work example I found from your link Beverleyh and it is a jquery script.I have never used jquery like that for anything.It is interesting.Thanks again.
-
BorderTerroir,thanks for trying to answer my question but I was looking to control the font color of a letter in the td.not the background color.Good tip though