why use css in js code example

Example 1: html css javascript

<!-- Answer to: "html css javascript" -->

<!--
  To keep things simple:
  HTML provides the basic structure of sites, which is enhanced and
  modified by other technologies like CSS and JavaScript. CSS
  is used to control presentation, formatting, and layout.
  JavaScript is used to control the behavior of different elements.
-->

For example:
<!--HTML-->
<div id="me">Click me!</div>
<!--CSS-->
<style>
  div {
    height: 128px; /* Makes the div 128px in height */
    width: 128px; /* Makes the div 128px in width */
    background: red; /* Makes the div's background, red */
  }
</style>
<!--JS-->
<script>
  document.getElementById("me".addEventListener("click", function(){
      document.getElementById("me").style.background = 'blue';
  });
</script>
<!-- If you want to test the code above, go to:https://www.w3schools.com/code/tryit.asp?filename=GDZ0PJDLYQ1V -->

<!--
  For more information, go to:
  https://blog.hubspot.com/marketing/web-design-html-css-javascript
-->

Example 2: html css js

<!DOCTYPE html>
<html lang="pt-br" xml:lang="fr" xmlns="http://www.w3.org/1999/xhtml">
<head>
	<link rel="stylesheet" type="text/css" href="style.css">
	<title>...</title>
</head>
<body>
	...
<script type="text/javascript" src="script.js"></script>
</body>
</html>

Tags:

Html Example