Skip to main content
 首页 » 编程设计

jquery之如何用 Sphinx 制作斑马 table 或者如何将 jQuery 与 Sphinx 一起使用

2025年05月04日37java哥

我认为从 Sphinx 生成的表格并不漂亮,因为它会为表格生成以下 HTML 代码。

<table border="1" class="docutils"> 
<colgroup> 
<col width="43%" /> 
<col width="29%" /> 
<col width="29%" /> 
</colgroup> 
<thead valign="bottom"> 
<tr><th class="head">Graph</th> 
<th class="head">HIR</th> 
<th class="head">AIR</th> 
</tr> 
</thead> 
<tbody valign="top"> 
<tr><td>Graph</td> 
<td>Circuit</td> 
<td>System</td> 
</tr> 
</tbody> 
</table> 

我怎样才能变成漂亮的 table ,例如斑马 table ?

HTML生成的html有jQuery,并且根据this site , 只需一行代码就可以得到斑马表,但我不确定如何使用 jQuery 来制作斑马表。

$("tr:nth-child(odd)").addClass("odd"); 
  • 问:如何将 jQuery 与 Sphinx 结合使用?
  • 问:有没有其他方法可以用 Sphinx 做一个斑马表?

请您参考如下方法:

我在doctools.js中添加了以下代码

$(document).ready(function() { 
  Documentation.init(); 
  $('tbody tr:even').css('background-color','#dddddd'); 
});