CSS (Cascading Style Sheets) is the language that allows you to style your HTML pages. It defines what your HTML elements should look like: colors, sizes, fonts, and much more. With CSS, you can create simple and professional designs.
<!DOCTYPE html>
<html>
<head>
<title>My first page</title>
</head>
<body>
<h1>Welcome!</h1>
<p>This is a simple web page.</p>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>My first page</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1 class="title">Welcome!</h1>
<p class="text">This is a simple web page.</p>
</body>
</html>
class attribute in the HTML code, as well as the values title and text.These values correspond to classes created in the style.css file and modify the appearance of the result.This is a simple web page.
<h1>Welcome!</h1>
<p>This is a simple web page.</p>
This is a simple web page.
<h1 class="title">Welcome!</h1>
<p class="text">This is a simple web page.</p>
You can write CSS directly in your HTML tags, but this quickly becomes complicated to maintain.
<h1 style="color: red; text-decoration: underline;">Important text</h1>
<style> tagThis is an intermediate solution where CSS remains in the HTML file.
<head>
<style>
h1 {
color: green;
text-transform: uppercase;
}
</style>
</head>
This is the best practice: a separate CSS file.
<link rel="stylesheet" href="style.css">