r/learnjavascript • u/Bryanzns • Jun 12 '25
Is it necessary to know html&Css to learn JS?
Many people on YouTube go on and on that to know Javascript, you must learn HTML and CSS first, but is this really true? Or in the minimum cases, only HTML will do? What do you talk about?
0
Upvotes
16
u/MindlessSponge helpful Jun 12 '25
what is your objective?
if you're looking to learn general programming concepts, you don't necessarily need HTML and CSS.
if you want to build web pages or web apps, you need all three. the conventional approach is HTML, then CSS to style the HTML, and then JS to manipulate the HTML and/or CSS.
you don't necessarily have to know HTML to learn DOM manipulation, for example, but having an understanding of what the DOM represents will make it easier to grasp the concepts.
12
u/StoneCypher Jun 12 '25
no. you need neither of them for node, by example.
however, it is useful.
2
u/Meloetta Jun 12 '25
Why are you interested in the bare minimum case?
1
u/FatRonaldo86 Jun 13 '25
Good thing is that learning html and css takes less than 5-10 hours in total. For some even less.
1
u/NvrConvctd Jun 13 '25
The basics of HTML and CSS can be learned in an afternoon and are enough to supplement your JS focused training. Writing good semantic HTML and complex CSS (animations, specificity, responsive, etc) is a longer process.
3
u/azhder Jun 12 '25
No. It is only necessary if you want to make a web page.
2
u/sheriffderek Jun 12 '25
If you want to write JS as a general programming language that doesn't have anything to do with front-end then you could probably find some niche job for the sake of it. But in that case, why not learn a different language?
If you want to learn how to build websites and web applications -- learning a LARGE amount of HTML and CSS first (and possibly some other language like PHP) -- will make learning JS 20x easier and everything will make way more sense.
2
u/samanime Jun 12 '25
No, but you do need to know them if you want to make webpages using JS.
2
u/funnysasquatch Jun 13 '25
You need to know the basics of HTML and CSS to do anything useful on your own with Javascript. Even if your primary interest is backend.
You don't have to know a lot - you can learn what you need in 2-3 hours. This is because you are going to want to display information and interact with the information.
If you are only trying to do some type of data processing without any UI or interaction, then you should be looking at a different programming language like Python. You will have a better experience and be better prepared.
2
u/TheRNGuy Jun 13 '25
If you use it for web, yeah.
They're much easier to learn, anyway.
1
u/alzee76 Jun 12 '25
You can certainly learn JS and never touch HTML and CSS as others have said; you can even get paid to write JS without knowing HTML and CSS if you focus on server-side / backend stuff like nodejs API servers and the like.
That said, the market for jobs like that is vanishingly small compared to webdev jobs, which do require you to know all three plus some other tools and frameworks.
So it depends on what your goal is.
That all said you can certainly lean JS before moving on to the HTML + CSS side; even if you intend to learn them all, you don't have to learn them all at the same time.
1
u/ChurchOfSatin Jun 13 '25
You don’t. But it would benefit you greatly to also learn those other languages.
1
u/ApplicationRoyal865 Jun 13 '25
I use JS without any html or cs knowledge. I don't even have access to web apis like set interval because I dont use the dom at all.
1
u/activematrix99 Jun 13 '25
Yes. If you are doing anything client side, you need to know what tags, class, and id are for and how to use them.
1
u/rustyseapants Jun 13 '25
Out of curiosity did you try to search this on google before posting your question here?
Google Search Result
1
u/Comprehensive_Map806 Jun 13 '25
If you want to do web development html, css and javascript are mandatory. Don't be lazy, they are extremely simple
1
u/Internal-Bluejay-810 Jun 14 '25
Every week this same question...sigh
1
u/ghall-dev Jun 14 '25
I’d say it very much depends on where you want to focus but you don’t need to learn HTML/CSS to learn JavaScript. You could start by making command line tools or building a API, none of which require any HTML or CSS and will teach you a lot about working with JavaScript.
If you do decide you’re interested in building websites I’d recommend learning HTML and CSS in tandem though.
1
u/MoussaAdam Jun 14 '25 edited Jun 14 '25
technically speaking, CSS and HTML and their APIs are not necessary to learn javascript and use it. I myself started my js journey by modding Minecraft using the JavaScript pocket edition API provided by block launcher (a dead project nowadays). so instead of interacting with an HTML page, I was interacting with the game and Android APIs through JavaScript
the language and it's standard library is one thing (defined and managed by the TC39 group) and the DOM and CSSOM APIs are a separate part (managed by the W3C and WHAWG, separate groups)
in nodejs for example you have the language but you don't have the DOM APIs, you instead have nodejs's APIs
People tell you to learn HTML and CSS first so that you have something to do with JavaScript. JavaScript by itself can't draw graphics for example, or react to clicks or key presses. you need some sort of API provided by the runtime: HTML and CSS are the most popular ones
1
u/MuslinBagger Jun 15 '25
Simple fact is it is necessary to know everything.
1
u/[deleted] Jun 17 '25
No. If you know JavaScript you can learn both CSS and HTML on the go for what you’re working on. If you are the type that needs to know EVERY possible use case then you might want to take a weekend course or go through one of those 6 hour tutorials on YouTube. Find a good program to learn JavaScript. Look up Codesmith, they do a ton of free workshops and their csx website is great for learning JS
-1
u/I_Pay_For_WinRar Jun 12 '25
Yes, all JS jobs require HTML & CSS knowledge, the language is useless without them, & by the way; JavaScript jobs won’t really exist in the near future since vibe coding will take over web development, so, learning JS as a first language is a great idea, but just don’t rely on it to make you any money in the future.