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.
index.html
99
1
2
3
4
5
6
7
8
9
10
11
12
<!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.
index.html
index.css
9
1
2
3
4
5
6
7
8
<!DOCTYPE html>
<html>
<!--Go to the index css file-->
<head>
<link rel="stylesheet" href="index.css" />
</head>
<body></body>
</html>
9
1
2
3
body {
background-color: blue;
}
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.
index.html
99
1
2
3
4
5
6
7
8
9
10
<!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.
index.html
index.js
index.css
9
1
2
3
4
5
6
7
8
9
<!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>
9
1
alert("Hello, world!")
9
1
2
3
body {
background-color: blue;
}
Was alles duidelijk?
Bedankt voor je feedback!
Sectie 3. Hoofdstuk 4
Vraag AI
Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.