In [1]:
from IPython import display

In the previous notebook we tried to modify the CSS of the NB output HTML. Some of the CSS properties we set were applied, but annoyingly not all of them. The reason was that the NB CSS stylesheet for the .output_html sections overrides some of our choices.

So, lets see if we can make our choices !important

In [3]:
styles = display.HTML("""<style>
th {
    background: black;
    color: white;
    font-weight: bold;
}
td { 
    vertical-align: top !important;
}
</style>""")
display.display(styles)

tbl = display.HTML("""<table>
<tr>
    <th>Title1</th>
    <th>Title 2</th>
</tr><tr>
    <td>Value 1</td>
    <td>Value 2<br/>Something else</td>
</tr>
</table>""")
display.display(tbl)
Title1 Title 2
Value 1 Value 2
Something else

Great, that worked. But we still don't know which properties we set will be overridden. This works but doesn't seem like a great solution...

In [ ]: