HTML
  Home arrow HTML arrow Page 4 - HTML Working with Images
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
HTML

HTML Working with Images
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2008-02-22

    Table of Contents:
  • HTML Working with Images
  • Alternatives to Images
  • Setting an Image as the Background
  • Setting Your Image as a Hyperlink

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    HTML Working with Images - Setting Your Image as a Hyperlink


    (Page 4 of 4 )

    Instead of using textual hyperlinks, you may sometimes wish to create hyperlinks using an image, providing for a pertier website. Here is how we do so:


    <html>

    <body>

    <p>

    Click the image to learn more about us!

    <a href="aboutus.htm">

    <img border="0" src="aboutus.gif" width="75" height="50">

    </a>

    </p>

    </body>

    </html>

    Here, the tag <a href> determines where our hyperlink will lead the user once they click the button. The <img border> is used to set the size of the border, and the src, as before, tells us the location of the image.

    Using Image Maps

    Another cool way to use an image as a hyperlink is to use image maps. Let's say you had a map of the United States, and whenever a user clicked on a certain state, it would load a page with information about that particular state. Each part of that image has a coordinate, based upon its location on the page. To see how coordinates work, use this code, then hover over your image and look at the bottom left hand corner of your browser; it will display the coordinates of wherever you hover your mouse: 

    <html>

    <body>

    <p>

    <a href="tryhtml_ismap.htm">

    <img src="sample.gif"

    ismap width="200" height="200">

    </a>

    </p>

    </body>

    </html>

    You will notice if you hover your mouse in the bottom right hand corner of the image, the coordinate will be around 200, 200. The top right hand corner will be 200, 0, while the bottom left corner will be 0, 200 and the top left corner will be 0, 0. And of course the center will be 100, 100.

    So let's say we wanted to create an image and have three links in it, at different locations. First we would find the coordinates of our link locations, then do the following:


    <html>

    <body>

    <p>

    Click on one of the planets to watch it closer:

    </p>

    <img src="sample.gif"

    width="145" height="126"

    usemap="#samplemap">

    <map id="samplemap" name="samplemap">

    <area shape="rect"

    coords="0,0,85,125"

    alt="Home"

    href="home.htm">

    <area shape="circle"

    coords="90,60,5"

    alt="Links"

    href="links.htm">

    <area shape="circle"

    coords="125,60,10"

    alt="About Us"

    href="aboutus.htm">

    </map>

    </body>

    </html>

    And there you have it, your first image map. You will note that the <area shape=> is used to define the clickable region or area of your image map.

    Well that is it for this article. In our next tutorial we will discuss working with layout in HTML and possibly fonts if time permits. Thanks for dropping by and be sure to come back often to read more material.

    Till then...


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · Thanks for dropping by. In thia article we discuss working with images in HTML. Some...
     

    HTML ARTICLES

    - Using a 3D HTML Table as a Recordset
    - Building a 3D HTML Table
    - Maximizing and Restoring HTML Images: Layer ...
    - Completing Construction of a Database Form w...
    - Maximizing and Restoring Images in a Tabular...
    - Building the Recordset for an HTML Database ...
    - Laying Out a Database Form with HTML
    - Tabular Database Form Functions with HTML
    - Tabular Database Forms with HTML
    - Using the Find Functions for HTML Database F...
    - Sorting for Database Forms with HTML
    - Edit and Other Database Form Functions with ...
    - More Database Form Functions with HTML
    - Database Form Functions with HTML
    - Using the HTML Table Element as a Recordset






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
    Stay green...Green IT