diff --git a/IPython/html/static/notebook/less/codemirror.less b/IPython/html/static/notebook/less/codemirror.less
index f3a257c..0de34f4 100644
--- a/IPython/html/static/notebook/less/codemirror.less
+++ b/IPython/html/static/notebook/less/codemirror.less
@@ -22,7 +22,7 @@
overflow-x: auto;
}
-@-moz-document {
+@-moz-document url-prefix() {
/* Firefox does weird and terrible things (#3549) when overflow-x is auto */
/* It doesn't respect the overflow setting anyway, so we can workaround it with this */
.CodeMirror-scroll {
diff --git a/IPython/html/static/style/ipython.min.css b/IPython/html/static/style/ipython.min.css
index c3c71f8..df2a7b8 100644
--- a/IPython/html/static/style/ipython.min.css
+++ b/IPython/html/static/style/ipython.min.css
@@ -83,7 +83,7 @@ div.out_prompt_overlay:hover{-webkit-box-shadow:inset 0 0 1px #000000;-moz-box-s
div.output_prompt{color:darkred;}
.CodeMirror{line-height:1.231em;height:auto;background:none;}
.CodeMirror-scroll{overflow-y:hidden;overflow-x:auto;}
-@-moz-document {.CodeMirror-scroll{overflow-x:hidden;}}.CodeMirror-lines{padding:0.4em;}
+@-moz-document url-prefix(){.CodeMirror-scroll{overflow-x:hidden;}}.CodeMirror-lines{padding:0.4em;}
.CodeMirror-linenumber{padding:0 8px 0 4px;}
.CodeMirror-gutters{border-bottom-left-radius:4px;border-top-left-radius:4px;}
.CodeMirror pre{padding:0;border:0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;}
diff --git a/IPython/html/static/style/style.min.css b/IPython/html/static/style/style.min.css
index d51de8c..b14ceca 100644
--- a/IPython/html/static/style/style.min.css
+++ b/IPython/html/static/style/style.min.css
@@ -1464,7 +1464,7 @@ div.out_prompt_overlay:hover{-webkit-box-shadow:inset 0 0 1px #000000;-moz-box-s
div.output_prompt{color:darkred;}
.CodeMirror{line-height:1.231em;height:auto;background:none;}
.CodeMirror-scroll{overflow-y:hidden;overflow-x:auto;}
-@-moz-document {.CodeMirror-scroll{overflow-x:hidden;}}.CodeMirror-lines{padding:0.4em;}
+@-moz-document url-prefix(){.CodeMirror-scroll{overflow-x:hidden;}}.CodeMirror-lines{padding:0.4em;}
.CodeMirror-linenumber{padding:0 8px 0 4px;}
.CodeMirror-gutters{border-bottom-left-radius:4px;border-top-left-radius:4px;}
.CodeMirror pre{padding:0;border:0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;}