Table and font bg color

Hi, everyone.
I want to know how to apply different bg color in table.

This is a example of Challenege Project.

Please Notice a left data of the table.

In first colume, you see two bg color, one is white that is applied to the letter and the other is purple that is equal to bg color of body.

Help me, I want to know how to apply two color.

1 Like

Try using class or id attribute for the elements that you want to style if you already know a bit of CSS.
If not, you can use inline CSS to change the background color. Like so:

<tr style="background-color:blue;">Some text</tr>


I did it. but I don’t know how to apply bg-color to only background of the text.

It’s my CSS code.

Oh, I see what you mean.
Wrap the text in <td> tag that holds info of the first column in a <span> tag and apply background-color to span. Like so:

        <td><span class="first-column">&lt;table&gt;</span></td>
        <td>The wrapper element for all HTML tables.</td>

And then in CSS style just the span:

.first-column {
background-color: whitesmoke;

I got it.
Thank you for your help!!!
It’s easy idea for you.

1 Like