To link a CSS file to your HTML document, you can use the <link> tag inside the <head> section of your HTML. Here’s how you can do it:
- Create a CSS file (e.g.,
styles.css) and add your styles. For example:
/* styles.css */
h1 {
color: red;
}
- In your HTML file, include the
<link>tag in the<head>section to link the CSS file:
<!doctype html>
<html>
<head>
<title>My Amazing Website</title>
<meta charset="UTF-8" />
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<h1>Hello, World!</h1>
</body>
</html>
This will apply the styles defined in styles.css to your HTML document.
