2

THis is a list table, and one list is disabled. As you guys know, the font color is a gray when it's disabled. I am using IE9, and I want to change the font color. Does anyone know how to change the disabled font color???

here is my code:

<table id="list" cellspacing="0" border="1" style="border-collapse: collapse;">
<tr disabled bgcolor =#EAEAEA  style="color:#ea0000;">
<td>name</td>
<td>email</td>
</tr>
<tr class="nameMail" onclick='op()'>
<td id="a">&nbsp</td>
<td id="b">&nbsp</td>
</tr>
</table>
Albright
  • 109
  • 2
  • 12
  • 2
    Why do you have a `disabled` attribute in your `` element? That's certainly not valid in HTML 4.01, and I don't believe it's valid in HTML 5 either. – ruakh Nov 23 '12 at 01:50
  • because the first is a list title, so I do not want it's selected when I hit the . op() is for the option "selected" – Albright Nov 23 '12 at 01:57
  • 1
    @Albright Table row selection has to be handled in Javascript anyway. Just make it skip title rows, marked using something semantic like `class="header"`. – millimoose Nov 23 '12 at 01:59
  • 1
    Why are you using outdated attributes for style, borders, etc? – epascarello Nov 23 '12 at 02:23
  • 1
    @millimoose - html provides a built-in method of semantically marking heading rows: the `` element... – nnnnnn Nov 23 '12 at 02:43
  • @nnnnnn You're right, that's the better choice here. – millimoose Nov 23 '12 at 11:32

1 Answers1

2

Your code is invalid.

You would do something like this:

 input[type="text"]:disabled
 {
    color:#ea0000;
 } 

Also, 'disabled' selector is supposed to be used mostly with form elements and controls.

If you want you can use a button within the tds like so:

  <table id="list" cellspacing="0" border="1" style="border-collapse: collapse;">
      <tr bgcolor="#EAEAEA"  style="color:#ea0000;">
        <td><button disabled>name</button></td>
       <td><button disabled>email</button></td>
      </tr>
      <tr class="nameMail" onclick='op()'>
        <td id="a">&nbsp</td>
        <td id="b">&nbsp</td>
     </tr>
   </table>

You would also, need to update the css like so to get rid of the button border.

  button{
   border:0;
   color:#ea0000;
   }

  button:disabled
  {
   color:#000;
  }
Rayshawn
  • 2,603
  • 3
  • 27
  • 46