Part 1 - Elements and tags§

1

Step 1 - Two sides of an HTML page: code and display§

2

Step 2 - Your first edit§

Warning

Learn the shortcuts: F5 to reload the page in the browser, Ctrl+S to save your file in the editor.

3

Remember...§

4

Step 3 - HTML tags§

HTML is based on elements. An element indicates that a part of the document has a specific role.

For example, if you want to stress your name in the sentence, you can use the em element.

The em element is identified by a start tag and a end tag.

Here is an example. Try it!

My name is <em>Amélie</em>

And this is the result:

My name is Amélie
5

Understanding HTML tags§

Most of the time, HTML elements have a start tag and a end tag.

Tags names are written inside angle brackets (greater than & less than symbols: “<” & “>”)

In the end tag, the tag name is preceded with a forward slash (/) sign.

For the element em, the start tag and end tag are:

<em> and </em>
6

Step 4 - Let's try another tag§

This is your first web page, it is very important!

Try to use the <strong> tag around the word first in the web page.

Admire the result in your browser.

7

Step 5 - More HTML tags§

8

Step 6 - Image (1/3)§

It's time to add an image in your page.

The element for including an image is img and the corresponding tag is <img>.

Here is an example:

<img src="TBL.jpg" alt="Inventor of the Web: Tim Berners Lee">

And this is the result:

Inventor of the Web: Tim Berners Lee
9

Step 6 - Image (2/3)§

<img src="mypicture.png" alt="This is my picture">

This tag has something new: alt and src are attributes.

Attributes specify behaviors of the tag.

Here, the src attribute indicates where to find the image, and the alt attribute defines an alternative text that will be displayed if the image cannot be loaded.

Warning

An img tag does not need a closing tag. It is quite rare.

10

Step 6 - Image (3/3)§

Using the img tag you have just learned, include in page1.html a photo of Sir Tim Berners Lee. You will find and image in the directory named images.

Be careful, as the photo is in the images directory, and because it is named "Sir_Tim_Berners_Lee.jpg", the alt attribute should be: alt="images/Sir_Tim_Berners_Lee.jpg.

11

Summary§

HTML is the language we use to build web pages.

A web browser reads HTML code and interprets it to display the corresponding web page.

HTML defines many elements and is written with tags (start tag and end tag) such as <p> and </p>.

Some elements may have attributes such as in the followig example:

<a href="page3.html">This is a link to page 3</a>
15