diff --git a/core/css.js b/core/css.js index 32f47a6f0..bac0d628c 100644 --- a/core/css.js +++ b/core/css.js @@ -84,9 +84,10 @@ Blockly.Css.inject = function(hasCss, pathToMedia) { // Strip off any trailing slash (either Unix or Windows). Blockly.Css.mediaPath_ = pathToMedia.replace(/[\\\/]$/, ''); text = text.replace(/<<>>/g, Blockly.Css.mediaPath_); - // Inject CSS tag. + // Inject CSS tag at start of head. var cssNode = document.createElement('style'); - document.head.appendChild(cssNode); + document.head.insertBefore(cssNode, document.head.firstChild); + var cssTextNode = document.createTextNode(text); cssNode.appendChild(cssTextNode); Blockly.Css.styleSheet_ = cssNode.sheet;