Welcome to Bucaro TecHelp!

Bucaro TecHelp
Maintain Your Computer and Use it More Effectively
to Design a Web Site and Make Money on the Web

About Bucaro TecHelp About BTH User Agreement User Agreement Privacy Policy Privacy Site Map Site Map Contact Bucaro TecHelp Contact RSS News Feeds News Feeds

Holiday Gift Guide
Holiday Gift Guide

Providing Alternate and Title Text for an Image

The alt and title attributes are both used to display text related to an image. The alt attribute has been around for a long time. Its purpose is, when an image fails to load, to display text instead. An example of the use of the alt attribute in an html image tag is shown below.

<img alt="Alt Text" src="imagename" />

Alt Text

Note the alt attribute does not work in Google's Chrome browser.

The title attribute is a general attribute that can be used with most html element tags, such as links and divs. Its purpose is to display popup text, commonly referred to as a "tool tip", when the user moves their mouse pointer over the html element. An example of the use of the title attribute in an html image tag is shown below.

<img title="Title Text" src="imagename" />

It's good practice to use both the alt and title attributes in your image tags, as shown below.

<img alt="Alt Text" title="Title Text" border="0" width="100" height="100" src="imagename" />

Note in the example above that I also used the border, width and height attributes. If you don't set the border attribute, the user's browser will use its default border size, and all browsers do not use the same default border size. If you don't set the width and height attributes, the browser will need to read this information from the image file, and this will cause your page to load slower.

Note in Internet Explorer, if the title attribute is not specified, it will look for the alt attribute, and if that is specified it will display the alt text instead.

More HTML Code:
• Wrapping Text Around Images
• Changing the Size of an Image on Your Webpage
• Divide a Table Into Head (thead), Body (tbody), and Footer (tfoot) Sections
• Using col and colgroup to Apply Attributes to a Table Column
• HTML DIV Basics
• HTML Special Characters - Character Entities
• Text Input Box Basics
• HTML5 Input Type - Email
• HTML Select List Basics
• Use HTML Target Attribute to Specify Where to Open Document

RSS Feed RSS Feed


Follow Stephen Bucaro Follow @Stephen Bucaro



Fire HD
[Site User Agreement] [Privacy Policy] [Site map] [Search This Site] [Contact Form]
Copyright©2001-2017 Bucaro TecHelp 13771 N Fountain Hills Blvd Suite 114-248 Fountain Hills, AZ 85268