• Post category:HTML

How to Change Font Color in an HTML Table

Table HTML Font Color

Learn how to change font color in an HTML table with easy steps:

1. Create your Table

We can easily create an HTML table using the <table> tag. Using HTML <tr> tag to create a table row and the HTML <td> tag to create a table data cell, we placed both tags inside <table> tag. You can name the table however you like, and in this guide, I created a one-row table as an example. Remember that: we should set the “border” attribute to <table> tag.

<table border="1">
<tr><td>COLUMN 1</td>
<td>COLUMN 2</td></tr>
</table>

2. Add a Color

We can change the color of this text using the CSS “color” property. In this, to color the cells inside the table, you need to set the color to the <td> tag.

Example:

<table border="1">
<tr><td style="color: blue;">COLUMN 1</td>
<td style="color: red;">COLUMN 2</td></tr>
</table>

Output:

table html font color

Conclusion

So, using the “color” CSS property is used to set the color of a text.

I hope you find this guide useful and keep learning to code!

Leave a Reply