How to link CSS?

QuestionsQuestions8 SkillsProYour First CSS LabSep, 01 2025
0117

To link a CSS stylesheet to your HTML document, you can use the <link> tag inside the <head> section. Here’s how to do it:

  1. Create a CSS file (e.g., styles.css) with your styles. For example:
h1 {
  color: blue;
}
  1. Link the CSS file in your HTML document like this:
<!doctype html>
<html>
  <head>
    <title>My First Web Page</title>
    <link rel="stylesheet" href="styles.css" />
  </head>
  <body>
    <h1>Hello HTML</h1>
  </body>
</html>

In this example, the <link> tag specifies the relationship (rel="stylesheet") and the location of the CSS file (href="styles.css"). Make sure the CSS file is in the same directory as your HTML file, or provide the correct path if it's located elsewhere.

If you have any further questions, feel free to ask!

0 Comments

no data
Be the first to share your comment!