The above code will work for you. It creates a new <style> tag and attaches it to the <head> tag. There should be no cross-browser issues.