Answers for "append css file with javascript"

7

javascript css link append

document.getElementsByTagName("head")[0].insertAdjacentHTML(
    "beforeend",
    "<link rel=\"stylesheet\" href=\"path/to/style.css\" />");
Posted by: Guest on March-20-2020
0

javascript add css file

var cssFile = document.createElement('link');
    cssFile.rel = 'stylesheet';
    cssFile.href = "styles.css";  // or path for file {themes('/styles/mobile.css')}
    document.head.appendChild(cssFile); // append css to head element
Posted by: Guest on March-25-2021
2

append css file with javascript

var cssFile = document.createElement('link');
    cssLink1.rel = 'stylesheet';
    cssLink1.href = "styles.css";  // or path for file {themes('/styles/mobile.css')}
    document.head.appendChild(cssFile); // append css to head element
Posted by: Guest on July-17-2020

Code answers related to "append css file with javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language