Relationship between JavaScript and HTML | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Relationship between JavaScript and HTML

This might seem dumb. But trying to understand how pieces fit, is it normal to have the HTML code be the "default" display of text for a webpage, and then the JavaScript handle divergences that come later, or am I missing something? Also, stupid question. But when I learned html in HS, we learned <center>. But CSS can handle that too. So in which apparatus is it considered "better" to handle that in?

31st Oct 2021, 12:29 AM
Rachel
Rachel - avatar
5 Answers
+ 3
Rachel HTML as per the name HYPER TEXT MARKUP LANGUAGE is used to design the markup or structure of the webpage. It is perfectly normal to use HTML for displaying text or other media and javascript handle the divergence or interactivity in the web page. Further, center tag was used in HTML4 and now it is not supported in HTML5.
31st Oct 2021, 1:07 AM
Art1mis
+ 3
They are just friends. Understand it like this: HTML is bones and whole skeleton, CSS is skin and makeup, Javascript is Brain & Muscle of a website.
31st Oct 2021, 5:24 AM
Arun Jamson
Arun Jamson - avatar
+ 3
It would be better if you use CSS3 for styling purposes, HTML only for structure and offcourse javascript for animating/activities.
31st Oct 2021, 5:27 AM
Mohd Aadil
Mohd Aadil - avatar
0
HTML is a markup language designs webpage CSS is a stylesheet styles the webpage JAVASCRIPT is a scripting language validates webpage
1st Nov 2021, 11:33 AM
sree harsha
sree harsha - avatar
0
<center> is old and deprecated. Don't use it anymore. The css way is the correct way. Also, javascript is only for logic purposes, since html is static and can't change. Javascript runs in your browser, so you can use it to manipulate your static html and create some functionality.
1st Nov 2021, 6:08 PM
[No Name]
[No Name] - avatar