Learning To Insert An Image On An HTML Docment

Inserting an image into an HTML document can be a simple task if one is aware of the specific tags and attributes that must be used. Images are defined by the <img> tag, which is an empty tag that only contains attributes. There is no closing tag. To display the image on the HTML document, the src (source) attribute must be used. This includes the URL of the image. For example, the syntax for defining an image would start with <img src=”url” alt=”some_text”/>

. The location of the tag determines the location of the image on the document. The src defines the source. The “url” represents the URL of the image, which allows the location of the image to be found. The “some_text” portion is used as an alternative display if the image is unable to be displayed. Therefore, the words will be displayed if the image can not be displayed. The final part of the task is establishing the height and width of the image. This process involves using the height and width attributes accordingly to display the desired height and width of the image. These attribute values are stated in pixels by default. However, if you state the height and width specifically, it must be in the following syntax.

<img src=”url” alt=”some_text” width=”some number” height=”some number” />.  The value of the desired height and width will be replaced in for the “some number” portion. Finally, the image can be displayed on the HTML document, as shown below.

Example: Day At The Beach

This process may seem complicated at first, but carefully following each of the above steps will indeed lead you to success in inserting an image on an HTML document!


Amber McAteer


~ by aleigh260 on September 24, 2012.

%d bloggers like this: