2

I just wanted to change the default font in Ipython (1.0.0) notebook markdown cells to something else, and tried doing this using style tags in a markdown cell instead of going through the path of creating a custom.css. I do not know CSS, and my needs are very minimal. After some research, I found the following code snippet:

<style>
div.text_cell_render {
font-family: "Times New Roman", serif;
...
}
</style>

I applied the above CSS code to a markdown cell, however the font in the other markdown text cells did not change. Do I have to turn something on first? Below is how it looks like:

Scrrenshot

2 Answers 2

3

On Ubuntu this works:

<style>
.text_cell_render {
font-family: Times New Roman, serif;
}
</style>

The ... in your example indicate other possible options like listed e.g. in http://www.w3schools.com/css/css_text.asp

However, this CSS applies to all rendered cell text, ie. markdown and heading. If you want to format just the markdown text use .text_cell_render p {. The individual headings can be addressed with h1, h2, etc instead of p.

3
  • it works in windows, too. But not in OSX for some reason. In neither Safari or Chrome I could make it work.
    – marillion
    Oct 16, 2013 at 19:28
  • Do you have a font named Times New Roman in OSX? Can you try with another font?
    – Jakob
    Oct 16, 2013 at 19:47
  • Try "Times". Worked fine for me on OSX.
    – benten
    Dec 3, 2015 at 16:03
0

To change the CSS style in a Jupyter notebook, simply create a cell at the top with the styles:

%%html
<style>
.rendered_html p {
    font-size: 17px;
    font-family: Ubuntu Mono;
    text-align:justify}
</style>

More information in here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.