Reputation: 15080
Ok in this case I ONLY focus on speed.
What is faster?
$('#header').css({'background':'#ff0000','width':'100px','height':'100px'});
$('#header').addClass('header');
I can't get the answer by using FireBug.
Upvotes: 0
Views: 116
Reputation: 21406
Just use Embedded CSS, that is #header
in css on our page. If you try to apply CSS using JavaScript, your page may not display correctly if JavaScript on browser is disabled. You may use external CSS file, embedded css on head and the inline CSS.
Always give priority to pure HTML and CSS. Trust me, its faster.
Upvotes: 4