diff --git a/IPython/html/static/auth/less/style.less b/IPython/html/static/auth/less/style.less
index 86be9c583..42f6f3170 100644
--- a/IPython/html/static/auth/less/style.less
+++ b/IPython/html/static/auth/less/style.less
@@ -1,2 +1,2 @@
-@import "../auth/less/login.less";
-@import "../auth/less/logout.less";
+@import "login.less";
+@import "logout.less";
\ No newline at end of file
diff --git a/IPython/html/static/base/less/style.less b/IPython/html/static/base/less/style.less
index 000adf017..18af1959d 100644
--- a/IPython/html/static/base/less/style.less
+++ b/IPython/html/static/base/less/style.less
@@ -1,4 +1,4 @@
-@import "../base/less/variables.less";
-@import "../base/less/mixins.less";
-@import "../base/less/flexbox.less";
+@import "variables.less";
+@import "mixins.less";
+@import "flexbox.less";
diff --git a/IPython/html/static/notebook/js/mathjaxutils.js b/IPython/html/static/notebook/js/mathjaxutils.js
index e35887dfe..0e76ae3e3 100644
--- a/IPython/html/static/notebook/js/mathjaxutils.js
+++ b/IPython/html/static/notebook/js/mathjaxutils.js
@@ -25,7 +25,9 @@ IPython.mathjaxutils = (function (IPython) {
processEscapes: true,
processEnvironments: true
},
- displayAlign: 'left', // Change this to 'center' to center equations.
+ // Center justify equations in code and markdown cells. Elsewhere
+ // we use CSS to left justify single line equations in code cells.
+ displayAlign: 'center',
"HTML-CSS": {
styles: {'.MathJax_Display': {"margin": 0}},
linebreaks: { automatic: true }
diff --git a/IPython/html/static/notebook/less/outputarea.less b/IPython/html/static/notebook/less/outputarea.less
index 225d3d791..59cf48c0a 100644
--- a/IPython/html/static/notebook/less/outputarea.less
+++ b/IPython/html/static/notebook/less/outputarea.less
@@ -3,6 +3,24 @@ div.output_area {
padding: 0px;
page-break-inside: avoid;
.hbox();
+
+ .MathJax_Display {
+ // Inside a CodeCell, elements are left justified
+ text-align: left !important;
+ }
+
+ .rendered_html {
+ // Inside a CodeCell, elements are left justified
+ table {
+ margin-left: 0;
+ margin-right: 0;
+ }
+
+ img {
+ margin-left: 0;
+ margin-right: 0;
+ }
+ }
}
diff --git a/IPython/html/static/notebook/less/renderedhtml.less b/IPython/html/static/notebook/less/renderedhtml.less
index db327b0c7..f78a65371 100644
--- a/IPython/html/static/notebook/less/renderedhtml.less
+++ b/IPython/html/static/notebook/less/renderedhtml.less
@@ -1,4 +1,4 @@
-.rendered_html{
+.rendered_html {
color: black;
em {font-style: italic;}
@@ -43,7 +43,15 @@
margin: 1em 2em;
}
- table, tr, th, td {
+ table {
+ // Center tables horizontally
+ margin-left: auto;
+ margin-right: auto;
+ border: 1px solid black;
+ border-collapse: collapse;
+ }
+
+ tr, th, td {
border: 1px solid black;
border-collapse: collapse;
margin: 1em 2em;
@@ -63,7 +71,22 @@
text-align: justify;
}
- p + p {
+ img {
+ display: block;
+ margin-left: auto;
+ margin-right: auto;
+ }
+
+ * + p {
margin-top: 1em;
}
+
+ * + table {
+ margin-top: 1em;
+ }
+
+ * + img {
+ margin-top: 1em;
+ }
+
}
diff --git a/IPython/html/static/style/ipython.min.css b/IPython/html/static/style/ipython.min.css
index b6cf270b4..bf9b14e37 100644
--- a/IPython/html/static/style/ipython.min.css
+++ b/IPython/html/static/style/ipython.min.css
@@ -130,7 +130,9 @@ p{margin-bottom:0;}
.end_space{height:200px;}
#notification_area{z-index:10;}
.notification_widget{color:#777777;padding:1px 12px;margin:2px 4px;z-index:10;border:1px solid #ccc;border-radius:4px;background:rgba(240, 240, 240, 0.5);}
-div.output_area{padding:0px;page-break-inside:avoid;display:-webkit-box;-webkit-box-orient:horizontal;-webkit-box-align:stretch;display:-moz-box;-moz-box-orient:horizontal;-moz-box-align:stretch;display:box;box-orient:horizontal;box-align:stretch;}
+div.output_area{padding:0px;page-break-inside:avoid;display:-webkit-box;-webkit-box-orient:horizontal;-webkit-box-align:stretch;display:-moz-box;-moz-box-orient:horizontal;-moz-box-align:stretch;display:box;box-orient:horizontal;box-align:stretch;}div.output_area .MathJax_Display{text-align:left !important;}
+div.output_area .rendered_html table{margin-left:0;margin-right:0;}
+div.output_area .rendered_html img{margin-left:0;margin-right:0;}
div.output_area pre{font-family:monospace;margin:0;padding:0;border:0;font-size:100%;vertical-align:baseline;color:black;background-color:transparent;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;line-height:inherit;}
div.output_subarea{padding:0.44em 0.4em 0.4em 1px;margin-left:6px;-webkit-box-flex:1;-moz-box-flex:1;box-flex:1;}
div.output_text{text-align:left;color:#000000;font-family:monospace;line-height:1.231em;}
@@ -171,11 +173,15 @@ div.quickhelp{float:left;width:50%;}
.rendered_html pre{margin:1em 2em;}
.rendered_html pre,.rendered_html code{border:0;background-color:#ffffff;color:#000000;font-size:100%;padding:0px;}
.rendered_html blockquote{margin:1em 2em;}
-.rendered_html table,.rendered_html tr,.rendered_html th,.rendered_html td{border:1px solid black;border-collapse:collapse;margin:1em 2em;}
+.rendered_html table{margin-left:auto;margin-right:auto;border:1px solid black;border-collapse:collapse;}
+.rendered_html tr,.rendered_html th,.rendered_html td{border:1px solid black;border-collapse:collapse;margin:1em 2em;}
.rendered_html td,.rendered_html th{text-align:left;vertical-align:middle;padding:4px;}
.rendered_html th{font-weight:bold;}
.rendered_html p{text-align:justify;}
-.rendered_html p+p{margin-top:1em;}
+.rendered_html img{display:block;margin-left:auto;margin-right:auto;}
+.rendered_html *+p{margin-top:1em;}
+.rendered_html *+table{margin-top:1em;}
+.rendered_html *+img{margin-top:1em;}
span#save_widget{padding:0px 5px;margin-top:12px;}
span#checkpoint_status,span#autosave_status{font-size:small;}
@media (max-width:767px){span#save_widget{font-size:small;} span#checkpoint_status,span#autosave_status{font-size:x-small;}}@media (max-width:767px){span#checkpoint_status,span#autosave_status{display:none;}}@media (min-width:768px) and (max-width:979px){span#checkpoint_status{display:none;} span#autosave_status{font-size:x-small;}}div.text_cell{padding:5px 5px 5px 5px;}
diff --git a/IPython/html/static/style/style.min.css b/IPython/html/static/style/style.min.css
index f281509aa..d2424793c 100644
--- a/IPython/html/static/style/style.min.css
+++ b/IPython/html/static/style/style.min.css
@@ -1511,7 +1511,9 @@ p{margin-bottom:0;}
.end_space{height:200px;}
#notification_area{z-index:10;}
.notification_widget{color:#777777;padding:1px 12px;margin:2px 4px;z-index:10;border:1px solid #ccc;border-radius:4px;background:rgba(240, 240, 240, 0.5);}
-div.output_area{padding:0px;page-break-inside:avoid;display:-webkit-box;-webkit-box-orient:horizontal;-webkit-box-align:stretch;display:-moz-box;-moz-box-orient:horizontal;-moz-box-align:stretch;display:box;box-orient:horizontal;box-align:stretch;}
+div.output_area{padding:0px;page-break-inside:avoid;display:-webkit-box;-webkit-box-orient:horizontal;-webkit-box-align:stretch;display:-moz-box;-moz-box-orient:horizontal;-moz-box-align:stretch;display:box;box-orient:horizontal;box-align:stretch;}div.output_area .MathJax_Display{text-align:left !important;}
+div.output_area .rendered_html table{margin-left:0;margin-right:0;}
+div.output_area .rendered_html img{margin-left:0;margin-right:0;}
div.output_area pre{font-family:monospace;margin:0;padding:0;border:0;font-size:100%;vertical-align:baseline;color:black;background-color:transparent;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;line-height:inherit;}
div.output_subarea{padding:0.44em 0.4em 0.4em 1px;margin-left:6px;-webkit-box-flex:1;-moz-box-flex:1;box-flex:1;}
div.output_text{text-align:left;color:#000000;font-family:monospace;line-height:1.231em;}
@@ -1552,11 +1554,15 @@ div.quickhelp{float:left;width:50%;}
.rendered_html pre{margin:1em 2em;}
.rendered_html pre,.rendered_html code{border:0;background-color:#ffffff;color:#000000;font-size:100%;padding:0px;}
.rendered_html blockquote{margin:1em 2em;}
-.rendered_html table,.rendered_html tr,.rendered_html th,.rendered_html td{border:1px solid black;border-collapse:collapse;margin:1em 2em;}
+.rendered_html table{margin-left:auto;margin-right:auto;border:1px solid black;border-collapse:collapse;}
+.rendered_html tr,.rendered_html th,.rendered_html td{border:1px solid black;border-collapse:collapse;margin:1em 2em;}
.rendered_html td,.rendered_html th{text-align:left;vertical-align:middle;padding:4px;}
.rendered_html th{font-weight:bold;}
.rendered_html p{text-align:justify;}
-.rendered_html p+p{margin-top:1em;}
+.rendered_html img{display:block;margin-left:auto;margin-right:auto;}
+.rendered_html *+p{margin-top:1em;}
+.rendered_html *+table{margin-top:1em;}
+.rendered_html *+img{margin-top:1em;}
span#save_widget{padding:0px 5px;margin-top:12px;}
span#checkpoint_status,span#autosave_status{font-size:small;}
@media (max-width:767px){span#save_widget{font-size:small;} span#checkpoint_status,span#autosave_status{font-size:x-small;}}@media (max-width:767px){span#checkpoint_status,span#autosave_status{display:none;}}@media (min-width:768px) and (max-width:979px){span#checkpoint_status{display:none;} span#autosave_status{font-size:x-small;}}div.text_cell{padding:5px 5px 5px 5px;}
diff --git a/IPython/html/static/tree/less/style.less b/IPython/html/static/tree/less/style.less
index a9c57631f..b294cc9d5 100644
--- a/IPython/html/static/tree/less/style.less
+++ b/IPython/html/static/tree/less/style.less
@@ -1,2 +1,2 @@
-@import "../tree/less/altuploadform.less";
-@import "../tree/less/tree.less";
+@import "altuploadform.less";
+@import "tree.less";
\ No newline at end of file