我试图用contentEditable =“true”来设置元素的样式(元素是表格单元格,如果这改变了任何东西)。我试过使用td[contenteditable]
,td[contenteditable=true]
,td[contenteditable="true"]
,而且都没有工作。有甚至有选择这些或我将不得不使用JavaScript?如何在CSS中选择contentEditable = true的元素?
这里的HTML:
<table class="table table-bordered">
<thead>
<th>content</th>
<th>editable content</th>
<th>content</th>
</thead>
<tr>
<td>Lorem ipsum</td>
<td contenteditable="true">I'm editable!</td>
<td>Lorem ipsum</td>
</tr>
<tr>
<td>Lorem ipsum</td>
<td contenteditable="true">I'm editable!</td>
<td>Lorem ipsum</td>
</tr>
<tr>
<td>Lorem ipsum</td>
<td contenteditable="true">I'm editable!</td>
<td>Lorem ipsum</td>
</tr>
</table>
向我们展示你的HTML – malutki5200
工作对我来说:http://jsbin.com/noputicufe/edit?html,css,js,output – Boldewyn
我会用'[CONTENTEDITABLE = “真”],[CONTENTEDITABLE = “”] ' – Oriol