Images are an important part of a website, they add flair and colour to a page that can look dull if it were just text.
The first step of adding an image to your page is to get an image saved in the same directory as your current HTML file. Once you have your image saved (mine is called "pig.png"), you can add it to your page using the following code:
<img src="pig.png" />
Resizing an image in HTML is very easy, all you need to do is add a width and/or height attribute to your image (shown below):
<img src="pig.png" width="200" />
Comments are notes to other developers that let them know what your code is doing. Using comments makes your code much more readable and assists other people understanding it. It also allows you to reference images without leaving text on your page. To start a comment we use
<!-- and to end a comment we use
-->, so a full comment would look like:
<!-- This is a comment -->
Below is an activity to test your HTML knowledge so far. Give it a try.
<html> <head> <title>Sample Page</title> </head> <body> </body> </html>