Think of web development like building a house – it's a great way to understand the roles of each technology.
This analogy will help you see how these three technologies complement each other. In this lesson, you'll explore each one in more detail and learn how they interact to build interactive websites.
What is HTML?
Basic HTML structure:
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>
Key points:
What is CSS?
Basic CSS syntax:
selector {
property: value;
}
CSS Example:
To change the background color and font color of a paragraph:
p {
background-color: yellow;
color: red;
}
Ways to add CSS to HTML:
<p style="color:blue;">This is a blue paragraph.</p>
<head>
<style>
p { color: blue; }
</style>
</head>
<head>
<link rel="stylesheet" href="styles.css">
</head>
What is JavaScript?
Basic JavaScript:
<button onclick="displayAlert()">Click Me!</button>
<script>
function displayAlert() {
alert('Button was clicked!');
}
</script>
Common uses of JavaScript:
Imagine you're creating a web-based quiz: