One approach that could be considered is creating a style element directly.
let cssInput = userInput;
let customStyle = document.createElement("style");
customStyle.type = 'text/css';
if (customStyle.styleSheet) customStyle.styleSheet.cssText = cssInput;
else customStyle.appendChild(document.createTextNode(cssInput));
You would first create the element, then set the type property, and proceed to append the user input to the cssText property if the browser supports it. If not, you can create a text node and add it instead.
Remember to always validate and sanitize user input to ensure security. Lastly, don't overlook appending the new style to the head tag for it to take effect.