Horje
How to include External CSS in an HTML Document ?

Adding External CSS in an HTML document is achieved using the <link> element in the <head> section. This approach allows you to separate your HTML content and styling. Here are some important points:

  • Establishing Connection (rel attribute): The <link> element uses the “rel” attribute to show how the HTML document is connected to the linked thing.
  • Identifying Resource Type (type attribute): The “type” attribute specifies what kind of data is linked. For CSS files, it’s set to “text/css,” telling that it’s a style sheet.
  • Locating the File (href attribute): The href attribute holds the address or web link to the external CSS file. Make sure it accurately points to where your CSS file is located.

Syntax

<link rel="stylesheet" type="text/css" href="styles.css">

Example: Implementation to show the addition of external CSS.

HTML

<!DOCTYPE html>
<html lang="en">
  
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>External CSS Addition</title>
  
    <!-- Include external CSS -->
    <link rel="stylesheet" type="text/css" href="styles.css">
</head>
  
<body>
    <!-- Your HTML content goes here -->
</body>
  
</html>




Reffered: https://www.geeksforgeeks.org


HTML

Related
What is the purpose of the colspan attribute in a HTML Table ? What is the purpose of the colspan attribute in a HTML Table ?
How do you create a numbered list in HTML 5 ? How do you create a numbered list in HTML 5 ?
Explain the difference between head Tag and header Tag in HTML5 ? Explain the difference between head Tag and header Tag in HTML5 ?
HTML Table Borders HTML Table Borders
Browser Object Model Browser Object Model

Type:
Geek
Category:
Coding
Sub Category:
Tutorial
Uploaded by:
Admin
Views:
18