Skip to content

Commit 8218efb

Browse files
authored
Update README.md
1 parent 38e007e commit 8218efb

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

README.md

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,48 @@
22

33
Create an HTML template and include it everywhere on your website using the `<template>` tag.
44

5-
## HTML
5+
## Template
66

7-
This is the main HTML page where we want to use the `<template>` tag. Use the `src` attribute to specify the source path for the HTML template file.
7+
This is the HTML template. Everything inside the `<head>` tag will later be replaced into the `<head>` tag of the actual page. The same is applied to the `<body>` tag.
8+
9+
`<script>` tags are **not** executed!
810

911
```html
10-
<!-- index.html (before template replace) -->
12+
<!-- template.html -->
1113
<!DOCTYPE html>
1214
<html lang="en">
1315
<head>
14-
<meta charset="UTF-8">
15-
<title>HTML-template</title>
16-
17-
<!-- include template.js script -->
18-
<script src="./template.js" type="module" defer></script>
16+
<link rel="stylesheet" href="style.css">
1917
</head>
2018
<body>
21-
<template src="./template.html"></template>
19+
<p>Hello World!</p>
2220
</body>
2321
</html>
2422
```
2523

26-
## Template
27-
28-
This is the HTML template. Everything inside the `<head>` tag will later be replaced into the `<head>` tag of the actual page. The same is applied to the `<body>` tag.
24+
## HTML
2925

30-
`<script>` tags are **not** executed!
26+
This is the main HTML page where we want to use the `<template>` tag. Use the `src` attribute to specify the source path for the HTML template file.
3127

3228
```html
33-
<!-- template.html -->
29+
<!-- index.html (before template replace) -->
3430
<!DOCTYPE html>
3531
<html lang="en">
3632
<head>
37-
<link rel="stylesheet" href="style.css">
33+
<meta charset="UTF-8">
34+
<title>HTML-template</title>
35+
36+
<!-- include template.js script -->
37+
<script src="./template.js" type="module" defer></script>
3838
</head>
3939
<body>
40-
<p>Hello World!</p>
40+
<template src="./template.html"></template>
4141
</body>
4242
</html>
4343
```
4444

45+
46+
4547
## Replace
4648

4749
This is the final version of the HTML page after the templates have been replaced.

0 commit comments

Comments
 (0)