以下のコード var element = document.createElement('style'); element.appendChild(document.createTextNode('')); document.getElementsByTagName('head')[0].appendChild(element); var sheet = element.sheet; // 以下のように CSSStyleSheet の先頭に二つのルールを挿入していく sheet.insertRule('html body { background: gray }', 0); // 0 番目にこのルールを挿入 sheet.insertRule('html body { background: red }', 0); // 0 番目にこのルールを挿入 このようにするとルールの順番は html