đź“ť Edit page
âž• Add page
Basic
Set up minimum values
Template
index.html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta content="width=device-width, initial-scale=1.0" name="viewport"> <meta content="IE=edge" http-equiv="X-UA-Compatible"> <title>My Title</title> <meta name="description" content="My description"> <link href="styles.css" rel="stylesheet"> <script defer src="main.js"></script> </head> <body> <div> <h1>My heading</h1> <p>My paragraph</p> </div> </body> </html>
Notes
- See info on the global lang attribute, which is used on the
html
element. - The character encoding set by
char
must appear as early as possible inhead
such as first. You’ll get a browser warning if you omit it. - It has basic metadata and language settings.
- CSS and JS assets are setup.
- JS script tag.
- Loading JS using
defer
attributes means it will get loaded after the body, even though it is set up in thehead
. You could take outdefer
attribute and put thescript
tag in thebody
rather. - Scripts set up with
defer
will load in a predictable order. - You could use
async
instead if you had something which can be loaded independently of the body (either before or after it) and independently of the other resources.
- Loading JS using