I want to center align the outputs (which includes text and plots) in my ipython notebook
. Is there a way in which I can add styling in the same notebook for the same? Code or screenshot examples would greatly help.
Try running this in a code-cell to override the default CSS for an output cell:
from IPython.display import display, HTML
CSS = """
.output {
align-items: center;
}
"""
HTML('<style>{}</style>'.format(CSS))
Example
You can see here that the right side of the table is cut-off a bit and the string that is printed wraps to the next line. This can be fixed by playing around with the CSS a bit, but you'll have to customize it to your own output.
In my case, I added the following lines to the CSS:
div.output_area {
width: 30%;
}
resulting in the following output:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With