We are independent & ad-supported. We may earn a commission for purchases made through our links.

Advertiser Disclosure

Our website is an independent, advertising-supported platform. We provide our content free of charge to our readers, and to keep it that way, we rely on revenue generated through advertisements and affiliate partnerships. This means that when you click on certain links on our site and make a purchase, we may earn a commission. Learn more.

How We Make Money

We sustain our operations through affiliate commissions and advertising. If you click on an affiliate link and make a purchase, we may receive a commission from the merchant at no additional cost to you. We also display advertisements on our website, which help generate revenue to support our work and keep our content free for readers. Our editorial team operates independently from our advertising and affiliate partnerships to ensure that our content remains unbiased and focused on providing you with the best information and recommendations based on thorough research and honest evaluations. To remain transparent, we’ve provided a list of our current affiliate partners here.

What is the Proper Way to Use an HTML Image Tag?

By Victoria Blackburn
Updated May 17, 2024
Our promise to you
WiseGEEK is dedicated to creating trustworthy, high-quality content that always prioritizes transparency, integrity, and inclusivity above all else. Our ensure that our content creation and review process includes rigorous fact-checking, evidence-based, and continual updates to ensure accuracy and reliability.

Our Promise to you

Founded in 2002, our company has been a trusted resource for readers seeking informative and engaging content. Our dedication to quality remains unwavering—and will never change. We follow a strict editorial policy, ensuring that our content is authored by highly qualified professionals and edited by subject matter experts. This guarantees that everything we publish is objective, accurate, and trustworthy.

Over the years, we've refined our approach to cover a wide range of topics, providing readers with reliable and practical advice to enhance their knowledge and skills. That's why millions of readers turn to us each year. Join us in celebrating the joy of learning, guided by standards you can trust.

Editorial Standards

At WiseGEEK, we are committed to creating content that you can trust. Our editorial process is designed to ensure that every piece of content we publish is accurate, reliable, and informative.

Our team of experienced writers and editors follows a strict set of guidelines to ensure the highest quality content. We conduct thorough research, fact-check all information, and rely on credible sources to back up our claims. Our content is reviewed by subject matter experts to ensure accuracy and clarity.

We believe in transparency and maintain editorial independence from our advertisers. Our team does not receive direct compensation from advertisers, allowing us to create unbiased content that prioritizes your interests.

Images are often added to web pages to make them look more inviting and interesting compared to a page of plain text. Using the HTML Image tag, it is easy to add images to any web pages. This tag also has a number of attributes, or characteristics, that you can specify.

When adding images to a web page, it’s important to remember that an image is not actually part of the file that makes up the web page itself. The files used for the web page are separate files from all image files. The HTML Image tag refers the web browser to the specific image file for the image that you want shown. When the web page is displayed in a browser, the image file is displayed along with any other files that make up that page.

The code for the HTML Image tag is: <IMG SRC="image location" />. Image location is the file name for the image you want to be shown and where the image is stored. It is important that you get this information correct to ensure the image is displayed properly. The organization and storage of images that you want to use on your web page are important considerations.

Some people store their images in the same directory as all the other parts of their web pages. In this case, when you refer to the image, you would only include the filename in the HTML Image tag. When a web page has a number of images, it is common to create a subdirectory, often called images. In this case, the subdirectory name would also be included in the tag.

As an example, here is what we would do to insert an image of a tree, filename tree.jpg, onto a web page. If we had stored the tree image in the same place as our other web page files, the HTML Image tag would be <IMG SRC="tree.jpg">. If the image file was stored in a subdirectory within our web page directory, the tag would be changed to <IMG SRC="images/tree.jpg">. What is important to remember is that the HTML Image tag provides a reference, or path, to the image file. Basically, it tells the browser where to look for the file.

The HTML Image tag has a number of attributes that can be specified for the image you want to include. Attributes are characteristics of the tag itself and so they are used within the tag, or between the < and >. The attributes that are used with the HTML Image tag are:

  • ALIGN — specifies how your image is aligned in relation to the text on your page (LEFT, RIGHT, TOP, MIDDLE, BOTTOM)
  • ALT — refers to alternative text. This is a very important attribute and should be included for all your images. It specifies the text that is displayed instead of the image
  • BORDER — adds a border to your image, with the thickness specified in pixels
  • HEIGHT and WIDTH — can be used to define the width and height of the image you want displayed, which allows you to change the size of the image. Be careful using these attributes as you can change the quality of the image and the proportions, resulting in poor quality images
  • VSPACE and HSPACE — are used to add white space around your image.
WiseGEEK is dedicated to providing accurate and trustworthy information. We carefully select reputable sources and employ a rigorous fact-checking process to maintain the highest standards. To learn more about our commitment to accuracy, read our editorial process.

Discussion Comments

WiseGEEK, in your inbox

Our latest articles, guides, and more, delivered daily.

WiseGEEK, in your inbox

Our latest articles, guides, and more, delivered daily.