how do you link CSS style sheet to HTML content

To link a CSS stylesheet to an HTML document, you can use the <link> tag within the <head> section of the HTML document. The link tag should have the following attributes:

  • href: This attribute specifies the location of the CSS file. It can be a relative or absolute URL.
  • rel: This attribute specifies the relationship between the HTML file and the linked file, and should be set to “stylesheet” for CSS files.
  • type: This attribute specifies the type of the linked file, and should be set to “text/css” for CSS files.

Here’s an example of how to link a CSS stylesheet to an HTML document:

<!DOCTYPE html>
<html>
<head>
	<title>My HTML Page</title>
	<link rel="stylesheet" type="text/css" href="mystyles.css">
</head>
<body>
	<!-- HTML content goes here -->
</body>
</html>

In this example, the mystyles.css file is located in the same directory as the HTML file. If your CSS file is located in a different directory, you’ll need to specify the path to the file in the href attribute.