can i write both of css and javascrip codes in the HTML file.. or i must write each one in i separated file? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

can i write both of css and javascrip codes in the HTML file.. or i must write each one in i separated file?

19th Oct 2016, 1:48 AM
Bader Salah
Bader Salah - avatar
4 Answers
+ 3
CSS and Javascript can be written in a single HTML file. Absolutely works fine. Nevertheless both of them use different tags: CSS - <style></style> Javascript - <script></script>. However, if your code for CSS and Javascript is huge, it is always a good practice to keep the code neat. Separate files would be recommended then.
19th Oct 2016, 1:55 AM
vinod dalawai
vinod dalawai - avatar
+ 2
You can put it in the same File. But separating the Stylesheets and Script Files is very recommended. The Website is loading faster if Css and JavaScript Files are separated. For very small programs it makes not very much difference, but in large projects.
20th Oct 2016, 10:59 AM
Fronz-Tec
Fronz-Tec - avatar
+ 1
yes, you can write both codes in same file.
19th Oct 2016, 1:57 AM
AKSHAY SAMEL
AKSHAY SAMEL - avatar
0
thank u all
19th Oct 2016, 2:00 AM
Bader Salah
Bader Salah - avatar