我正在使用TinyMCE插件。现在我需要为表设置css类。我在上找到了一些信息http://www.tinymce.com/wiki.php/Configuration:table_class_list . 但我如何在wordpress的TinyMCE插件中应用它呢?或者有更好的解决方案来为TinyMCE中的表设置css类?
我可以通过TinyMCE为表设置CSS类吗
1 个回复
SO网友:bueltge
这可以通过自定义插件实现,但需要付出很多努力。
我喜欢前端css的方式。
TinyMCE中的table按钮创建了一个默认表,没有类,如:
<table>
<tr>
<td>Text</td>
<td>Text</td>
<td>Text</td>
</tr>
<tr>
<td>Text</td>
<td>Text</td>
<td>Text</td>
</tr>
<tr>
<td>Text</td>
<td>Text</td>
<td>Text</td>
</tr>
</table>
下面是一个简单的示例,可以为每个raw中的不同颜色设置此格式。table{
color: #111;
width: 100%;
margin: 2px auto;
padding: 0;
border: 1px solid #eee;
border-collapse:collapse;
}
table td{
padding: 7px;
border: 1px solid #eee;
}
/* provide some minimal visual accomodation for IE8 and below */
table tr{
background: #eee;
}
/* Define the background color for all the ODD background rows */
table tr:nth-child(odd){
background: #eee;
}
/* Define the background color for all the EVEN background rows */
table tr:nth-child(even){
background: #fff;
}
结束