Home › Forums › JavaScript › How to load CSS using javescript › Re: How to load CSS using javescript
January 22, 2013 at 3:23 am
#121827
rosspenman
Participant
It is indeed possible.
var s = document.createElement(‘link’);
s.setAttribute(‘href’, ‘style.css’);
document.head.appendChild(s);
But sometimes using JavaScript isn’t the best idea. Have you thought about using media queries instead?