Using External Resources
When you develop web pages with HTML, you often need to link to external resources. For example, we usually keep our CSS and JavaScript codes in separate files.
Adding external CSS files
Suppose your CSS codes are in an "index.css" file. You use the <link> tag to link that file to your HTML code. We place this <link> tag inside the <head> tag.
With the <link> tag, we use the rel attribute to define the relationship of the external file and the href attribute to assign the external file path.
Here is the code we use for that:
<link rel="stylesheet" href="index.css" />
index.html
index.css
Adding external Javascript files
When we want to add external Javascript files to our HTML web page, we use the <script> tag with the src attribute.
<script src="index.js"></script>
index.html
index.js
Дякуємо за ваш відгук!
Запитати АІ
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат
Запитайте мені питання про цей предмет
Сумаризуйте цей розділ
Покажіть реальні приклади
Чудово!
Completion показник покращився до 7.69
Using External Resources
Свайпніть щоб показати меню
When you develop web pages with HTML, you often need to link to external resources. For example, we usually keep our CSS and JavaScript codes in separate files.
Adding external CSS files
Suppose your CSS codes are in an "index.css" file. You use the <link> tag to link that file to your HTML code. We place this <link> tag inside the <head> tag.
With the <link> tag, we use the rel attribute to define the relationship of the external file and the href attribute to assign the external file path.
Here is the code we use for that:
<link rel="stylesheet" href="index.css" />
index.html
index.css
Adding external Javascript files
When we want to add external Javascript files to our HTML web page, we use the <script> tag with the src attribute.
<script src="index.js"></script>
index.html
index.js
Дякуємо за ваш відгук!