How to link CSS to HTML?

0109

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:

  1. Create a CSS file (e.g., styles.css) and add your styles. For example:
/* styles.css */
h1 {
    color: red;
}
  1. 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.

0 Comments

no data
Be the first to share your comment!