How to link CSS external file in the HTML head section?

Query By: KABITA MAJHI

V

Vivek

Link of External Style File in <head> Section

To link the External Style file in the <head> section, first, you should need to create a separate CSS file with all your styles and link it to your HTML document using the <link> element. Using separate CSS files makes it easier to maintain and reuse styles across multiple pages.


Syntax Example of CSS File

/* styles.css */

body { font-family: Arial, sans-serif; background-color: #f0f0f0; color: #333; }

h1 { color: #0066cc; }


/* HTML code, Using CSS file with the help of <link> tag */

<!DOCTYPE html>

<html>

<head>

  <title>Web Page</title>

  <link rel="stylesheet" href="styles.css"> //here CSS filed called

</head>

<body>

  <h1>Hello, World!</h1>

</body>

</html>

1 votes

Your Answer

Email Us: advertise@gdatamart.com

Donate Us: Support to GDATAMART

LifeStyle & Fun

© 2024 GDATAMART.COM (All Rights Reserved)