Javascript And Css Link

Javascript and css link
Link your CSS file within the head tag of your HTML with the following code: <link rel="stylesheet" href="box. css"> Link your JS file within the body tag at the very bottom of your code, immediately below the last closing div and above the closing body tag like this: <script src="box. js"></script>

main.css File

body {
  background-color: lightblue;
}

h1 {
  color: white;
  text-align: center;
}

main.js File

document.querySelector("h1").innerHTML = "My First JavaScript";

index.html

<!doctype html>
<html lang="en">
  <head>
	...............
	<link rel="stylesheet" href="main.css"/>
	.....................
  </head>
  <body>
    <h1>Hello, world!</h1>
		....................
		<script href="main.js"></script>
		....................
  </body>
</html>

Write a Associte Comment
Markdown Editor