I've recently started learning javascript, and i have almost 0 knowledge in html and css. Can anyone give me a simple roadmap on which to learn first?
+Thanks everyone for the reply, helps a lot :)
html - Better or Worse: Styling with JavaScript vs CSS - Stack Overflow
JavaScript Vs. HTML/CSS
Should I learn Javascript or HTML/CSS first?
ELI5: The difference between HTML5, CSS and other web-based languages.
What’s the difference between HTML, CSS, and JavaScript?
Should I learn HTML or CSS first?
Is HTML the same as CSS?
Videos
Your styling should be done using CSS wherever possible. Have different classes setup according to your needs, then add or remove classes when absolutely necessary with JS.
One thing to keep in mind is that changing styling via JS is a one-time change. Elements added dynamically VIA Ajax won't inherit the styling changes automatically. Another good reason to stick with CSS.
See this post for additional confirmation Should I load responsive design via JS or CSS
As suggested in the link
Putting everything regarding styles in the CSS files is the best practice.
HTML => Structure
CSS => Styles
JS => Logic
CSS is the best way to style an (X)HTML document.
Even if you need to style a document by using raw JavaScript or DOM, or some framework like jQuery, it'll mean you're giving values to CSS rules.
The rule should be:
Use pure CSS when you can style a predictable document - also you can enhance your CSS and use CSS selectors for generalized or complex scenarios -.
Use JavaScript/DOM or frameworks like JavaScript when document or portions of it aren't predictable or are created on-the-fly and you're applying special effects like fades or any other - in fact, CSS 3.0 has transitions so it's possible to do a lot of things without JavaScript -.
After all, think how simpler can be things done with CSS and what kind of overkill is using JavaScript instead, and keep in mind its cons (a very important point: browser compatibility and performance).
The more CSS you use, the more standarized, cross-browser, performant and maintainable web.
Hi everyone,
I wanted to ask what does JavaScript do and can it reliably do it without much html/css?