سؤال

I would like to edit the content of a cell in an HTML table.

Is there an attribute for editing or I have to use some kind of script?

هل كانت مفيدة؟

المحلول 2

Found the answer myself.. Just go in the wanted cell and put the contenteditable attribute like this:

<td contenteditable>Whatever</td>

نصائح أخرى

If you do not want to do it manually, then you have to define an attribute for the td and then by css, you have to apply the content that you want by declaring an :after or :before class.

For instance, Here is the WORKING SOLUTION

The HTML:

<table width="100%" border="1" cellspacing="0" cellpadding="0">
  <tr>
    <td title="abc">&nbsp;</td>
    <td title="def">&nbsp;</td>
  </tr>
</table>

The CSS:

td[title=abc]:after{content:"red"}
td[title=def]:after{content:"blue"}

I hope this is what you want.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top