Skip to content

Instantly share code, notes, and snippets.

@sdelquin
Last active May 25, 2021 03:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sdelquin/b6ee82c0edf5fac5f330f699af7ab99a to your computer and use it in GitHub Desktop.
Save sdelquin/b6ee82c0edf5fac5f330f699af7ab99a to your computer and use it in GitHub Desktop.
Load custom CSS for Jupyter Notebook
from IPython.display import HTML
from pathlib import Path
css_rules = Path('custom.css').read_text()
HTML('<style>' + css_rules + '</style>')
@sdelquin
Copy link
Author

/* title of columns */
table.dataframe thead th {
    font-size: 1.2em !important;
    padding-top: 0.2em !important;
    padding-bottom: 0.2em !important;
}

/* title of rows */
table.dataframe tbody th {
    font-size: 1.2em !important;
    background: rgba(199, 199, 199, 0.356) !important;
    border: 1px solid black !important;
}

/* style for each cell */
table.dataframe td {
    font-size: 1.15em !important;
    border: 1px solid black !important;
}

/* disable zebra-style */
table.dataframe tbody tr {
    background: white !important;
}

/* row color on hover */
table.dataframe tbody tr:hover {
    background: rgba(43, 137, 226, 0.144) !important;
}

/* Settings for slides */

.present table.dataframe thead th {
    font-size: 1.5em !important;
}

.present table.dataframe tbody th {
    font-size: 1.5em !important;
}

.present table.dataframe td {
    font-size: 1.3em !important;
}

.present table.dataframe thead th {
    border-bottom: none !important;
    padding-top: 0.1em !important;
    padding-bottom: 0.1em !important;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment