In the IPython notebook cell below, you will see a table with a gray background and borders:
from IPython.display import HTML
s="""
<style type="text/css">
table, td {
border-collapse: collapse;
border-style: hidden;
background-color: rgb(240,240,240);
}
</style>
<table>
<tr>
<td>a
<td>b
<tr>
<td>c
<td>d
</table>
"""
h = HTML(s); h
However, interestingly, when the same html content (with the content of string s) is placed in a plain HTML file's body, the table appears with a gray background and without any border, which is actually the desired effect. It seems like the border properties do not function correctly in the IPython notebook environment. Do you have any thoughts on why this might be happening?
Another intriguing discovery: if a colgroup is added to the table along with a col to the css selector, all elements except for the horizontal rule between rows vanish in the IPython notebook setting.