What are HTML, JavaScript, and CSS?
sobes.tech AI
Answer from AI
HTML (HyperText Markup Language) is a markup language for creating the structure of web pages. It defines page elements: headers, paragraphs, images, links.
CSS (Cascading Style Sheets) is a style language for designing web pages. It is responsible for the appearance of elements: colors, fonts, margins, layout.
JavaScript is a programming language for adding interactivity to web pages. It allows changing content, responding to user actions, sending requests to the server without reloading the page.
Example of interaction:
<!DOCTYPE html>
<html>
<head>
<title>Example</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<h1 id="title">Hello everyone</h1>
<button onclick="changeText()">Change text</button>
<script src="script.js"></script>
</body>
</html>
/* styles.css */
#title {
color: blue;
font-size: 24px;
}
// script.js
function changeText() {
const titleElement = document.getElementById('title');
titleElement.textContent = 'Text changed!';
titleElement.style.color = 'red';
}
In this example, HTML defines the structure (header and button), CSS styles the header (blue color, size 24px), and JavaScript adds interactivity (clicking the button changes the header text and makes it red).