简体   繁体   中英

How to change the font size and color of markdown cell in Ipython (py 2.7) notebook

I am trying to write a paper in Ipython notebook, therefore I want to decorate it a little bit. Usually I do it with the "#" to change the size. However, I noticed that the # stops working when the indent is more than 4

###Python Paper
       ####Python Oaoer

I also tried: .text_cell_render { font-family: Times New Roman, serif; } However it shows invalid syntax error.

Another method I tried was to locate the ipython in my laptop. That went south too. Could anybody elaborate a little.

I am fairly new to Python, forgive my ignorance and request for spoon-feeding. Thanks in advance

If you want to change the appearance of your notebook, please refer to this document: iPython style sheets

CSS in a cell is not recommended but is possible like so:

from IPython.core.display import HTML
HTML("""
<style>

div.cell { /* Tunes the space between cells */
margin-top:1em;
margin-bottom:1em;
}

div.text_cell_render h1 { /* Main titles bigger, centered */
font-size: 2.2em;
line-height:1.4em;
text-align:center;
}

div.text_cell_render h2 { /*  Parts names nearer from text */
margin-bottom: -0.4em;
}


div.text_cell_render { /* Customize text cells */
font-family: 'Times New Roman';
font-size:1.5em;
line-height:1.4em;
padding-left:3em;
padding-right:3em;
}
</style>
""")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM