0
How to link html file with css
Hey gyess how ho link .css to html file and js file
1 Answer
+ 3
Link a CSS file:
In your HTML file, add the following code inside the <head> section to link an external CSS file: <link rel="stylesheet" href="styles.css"> Replace "styles.css" with the path to your CSS file.
Link a JavaScript file:
To link a JavaScript file, add the following code before the closing </body> tag: <script src="script.js"></script> Or, if you want to place the script in the <head> section, use the defer attribute to make sure it loads after the page: <script src="script.js" defer></script> Replace "script.js" with the path to your JavaScript file.
Example:
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Example Page</title>
    <link rel="stylesheet" href="styles.css">
    <script src="script.js" defer></script>
</head>
<body>
    <h1>Hello, World!</h1>
</body>
</html>