HTML shorter way for different colors in a table?
I use such a lengthy code in each cell:
<font color="green"> ... </font>
Is there a shorter way, for example a shorter tag for each color?
I need to define a short for each color
<gg> for green
<rr> for red
and then use the short tag in table
<tr>
<td><gg>green
<td><rr>red
Just this!
Public Comments
- You can't get any shorter than that aside from entering the HEX number.
- Also, the color="green" will only work in the Microsoft javascript browsers. You could set up an array of your colors. Then call by color[3]. Or you could set up CSS stylesheet.
- Use the style attribute on the td <table> <tr> <td style="color:#ff0000"> Red color text </td> <td style="color:#00ff00"> Green color text </td> </tr> </table>
- Use css <style type="text/css"> .green{ background-color:#00FF00; } .blue{ background-color:#0000FF; } </style> <td class="green"> blah </td> <td class ="blue"> whateva </td> ------------- You can't really make up your own custom tags, but you could fake it. Use <gg> for green and </font> to close the block <rr> for red and </font> to close the block Then do a series of find and replace all in your editor replace <gg> with <font color="green"> replace <rr> with <font color="red"> You can also use a macro preprocessor to do basically the same thing, web pre processor(wpp) is one example.
- You should use CSS. To add to Vegan's post - all the TDs can be colored using the td selector.
Powered by Yahoo! Answers