HTML is a language you use to create web pages. Today, we'll create a web page that says "Hello world" in big letters.
#0 Elements & tags
When you write HTML code, you write one or more elements
,
e.g. (<body>
). These are also called tags
, although the <
is
also a tag so it can get confusing. In this course we'll thus use
element
to mean <body>
and tag
to mean <
and >
.
There are two kinds of elements: block level elements that can contain
other elements (e.g. <html>
) and inline elements that only can
contain text (<h1>
).
#1 Create a file called hello.html
In your editor, create a new file and call it hello.html
.
#2 Add the html element
<html>
</html>
#3 Add the body element
<html>
<body>
</body>
</html>
#4 Finally, add the h1 element.
The h stands for headline and 1
means it's the biggest
headline. There are also <h2>
, <h3>
, <h4>
, <h5>
and <h6>
for
smaller headlines, just like you have in your document processor:
<html>
<body>
<h1>Hello world</h1>
</body>
</html>
That's it. You can now open your browser, e.g. Firefox, and open the
hello.html
file to view the result. Congratulations, you've now
made your first web page!
Counting from zero 🎭
Did you notice above that the first item was numbered 0 rather than 1? This is common coding humour. In computer science, many thing start with 0 instead of 1 and coders like to use 0 as the first item when writing emails, chats or posters too.
Further reading
Easy: Learn and try out HTML at w3schools.com
In depth: HTML is a standard maintained by a group called W3C, read the full details of the HTML language on their website: HTML 5.2 at W3C.