如何更改html表格中的字体颜色?

时间:2017-05-29 18:07:11

标签: html fonts colors

如何更改html表格中的字体颜色?

<table>
<tbody>
<tr>
<td>
<select name="test">
<option value="Basic">Basic : $30.00 USD - yearly</option>
<option value="Sustaining">Sustaining : $60.00 USD - yearly</option>
<option value="Supporting">Supporting : $120.00 USD - yearly</option>
</select>
</td>
</tr>
</tbody>
</table>

我试过了

<span style="color: #0000ff;"> 
</span> 

在多个地方......哪些不起作用。

5 个答案:

答案 0 :(得分:5)

<table>
<tbody>
<tr>
<td>
<select name="test" style="color: red;">
<option value="Basic">Basic : $30.00 USD - yearly</option>
<option value="Sustaining">Sustaining : $60.00 USD - yearly</option>
<option value="Supporting">Supporting : $120.00 USD - yearly</option>
</select>
</td>
</tr>
</tbody>
</table>

答案 1 :(得分:3)

这样的事情,如果想要去上学。

<font color="blue">Sustaining : $60.00 USD - yearly</font>

虽然更现代的方法是使用css风格:

<td style="color:#0000ff">Sustaining : $60.00 USD - yearly</td>

当然有更普遍的方法可以做到。

答案 2 :(得分:1)

table td{
  color:#0000ff;
}

<table>
  <tbody>
    <tr>
    <td>
      <select name="test">
        <option value="Basic">Basic : $30.00 USD - yearly</option>
        <option value="Sustaining">Sustaining : $60.00 USD - yearly</option>
        <option value="Supporting">Supporting : $120.00 USD - yearly</option>
      </select>
    </td>
    </tr>
  </tbody>
</table>

答案 3 :(得分:0)

如果您需要从选择菜单中更改特定选项 你可以这样做

option[value="Basic"] {
  color:red;
 }

或者你可以全部改变

select {
  color:red;
}

答案 4 :(得分:0)

试试这个:

 <html>
    <head>
        <style>
            select {
              height: 30px;
              color: #0000ff;
            }
        </style>
    </head>
    <body>
        <table>
            <tbody>
                <tr>
                    <td>
                        <select name="test">
                            <option value="Basic">Basic : $30.00 USD - yearly</option>
                            <option value="Sustaining">Sustaining : $60.00 USD - yearly</option>
                            <option value="Supporting">Supporting : $120.00 USD - yearly</option>
                        </select>
                    </td>
                </tr>
            </tbody>
        </table>
    </body>
</html>
相关问题