Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn CSS and Javascript | Metadata and the Head Element
Introduction to HTML

book
CSS and Javascript

To include CSS in the head element of an HTML document, you can use the <style> tag. Inside this tag, you can write your CSS styles.

html

index.html

copy
<!DOCTYPE html>
<html>
<head>
<!--CSS code-->
<style>
body {
background-color: blue;
}
</style>
</head>
<body></body>
</html>

To include an external CSS file in an HTML document, you can also use the <link> element.

html

index.html

css

index.css

copy
<!DOCTYPE html>
<html>
<!--Go to the index css file-->
<head>
<link rel="stylesheet" href="index.css" />
</head>
<body></body>
</html>

To include JavaScript in the head element of an HTML document, you can use the <script> tag. Inside this tag, you can write your JavaScript code.

html

index.html

copy
<!DOCTYPE html>
<html>
<head>
<!--JS code-->
<script>
alert("Hello, world!");
</script>
</head>
<body></body>
</html>

You can also include an external JS file in an HTML document.

html

index.html

js

index.js

css

index.css

copy
<!DOCTYPE html>
<html>
<!--Go to the index css and index js file-->
<head>
<script src="index.js"></script>
<link rel="stylesheet" href="index.css" />
</head>
<body></body>
</html>

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 3. Chapter 4
some-alt